Skip to content

ADescribe · Guide test 100

Conover squared ranks test

Tests scale homogeneity through ranks of deviations from group centers.

Runs in CodeSplashPython (calls R) example not runR example validated

Do it in CodeSplash

In the app, set it up in Analyze with this method:

In Equal spread tests, choose Test = Conover squared ranks.

Do it in CodeSplash Run this test on your own data, in Python or R.

Bench

Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.

Bench · Conover squared ranks test

20
20
0.80
1.0
2.0
0.050

Alternative

Your data

Drag a point or use ↑/↓ to change it
Group 1 · n = 20 · mean 0.87Group 2 · n = 20 · mean −0.29

If H₀ were true

z = −2.89
  1. The reference: how z varies across samples when H₀ is true (conditional normal approximation).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .004).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

T=∑i∈xR(∣xi−xˉ∣)2T = \sum_{i\in x} R\left(|x_i-\bar x|\right)^2

With your numbers

T=6547,z=(−2.89)T = 6547,\quad z = (-2.89)
R(⋅)R(\cdot)
pooled rank of the absolute deviation

The verdict

T = 6547.00, z = −2.89, p = .004

p ≤ α = .050: reject H₀

Centers each group first, so unlike Ansari–Bradley it does not need equal locations.

Statistic
−2.894
p-value
0.0038
Conover squared ranks test on Group 1: n = 20; Group 2: n = 20: T = 6547.00, z = −2.89, p = .004. The p-value is below α = .050, so the data are hard to reconcile with H0.

Conover squared ranks test on Group 1: n = 20; Group 2: n = 20: T = 6547.00, z = −2.89, p = .004. The p-value is below α = .050, so the data are hard to reconcile with H₀.

Question and hypotheses

H0: group scales are equal under a common shape model.

Assumptions

Independent groups; comparable shapes and a specified group center. Mean-centered versions require a meaningful finite mean.

Formula

zij=∣xij−xˉj∣aij=rank⁡(zij)2Q=∑jnj(aˉj−aˉ)2sa2\begin{gathered}z_{ij}=|x_{ij}-\bar x_j|\\[5pt] a_{ij}=\operatorname{rank}(z_{ij})^2\\[5pt] Q=\frac{\sum_jn_j(\bar a_j-\bar a)^2}{s_a^2}\end{gathered}

Parameters and notation

Rank centered absolute deviations jointly, then square the ranks; sa² is pooled score variance. Two sample versions use a standardized score sum.

Structure of the method

Estimate a center within each group, rank the pooled absolute centered deviations, square their ranks, and compare group score means. A pooled-score variance normalizes the omnibus contrast. This is the squared-ranks dispersion procedure, distinct from similarly named rank-based location post-hoc comparisons.

Estimated and nuisance parameters

Mean-centered versions estimate group means before ranks and score moments; the center convention is part of the model. The squared ranks are data-derived scores, and their covariance supplies calibration. Finite group means are needed for the stated mean-centered interpretation.

Settings and design choices

Specify mean versus any alternative centering, score convention, group or block definition, and conditional/asymptotic distribution. The coin implementation labels its mean-centered dispersion version Conover–Iman; retain the scale context to avoid confusing it with location comparison procedures of similar names.

Fitting and adaptation

Re-estimate centers and reconstruct deviations for a new sample. When assessing a raw-data resampling procedure, reproduce the centering algorithm and justify its null; a package’s conditional score inference is a specific construction and should not be equated automatically with all label-permutation schemes.

Sensitivity and robustness

Outliers can influence estimated means before ranking, and many identical deviations reduce rank information. Different locations and distribution shapes may affect finite-sample behavior. Check score variance and group sizes for degeneracy. Adaptation means refitting and validating calibration, not neural fine-tuning.

How to use and calibrate

Use the implementation’s conditional or asymptotic score distribution, with tie handling.

Example application

Compare group dispersions using squared deviation ranks.

Interpretation and pitfalls

Watch out

Conover squared ranks is different from Conover–Iman location post hoc tests. Group centering is part of the method and resampling must respect it.

What changed in edition 2

  • New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.

Python and R

Independent two-group score test of scale; uses the asymptotic conditional reference.

Python · invokes R

Not run — Executed end to end through Rscript · needs Python standard library + Rscript; R packages: coin

# Python launcher for the complete R implementation below.
# Requires Rscript on PATH and the listed R packages.
import shutil
import subprocess
rscript = shutil.which("Rscript")
if rscript is None:
    raise RuntimeError("Install R and make Rscript available on PATH.")
r_code = r"""
set.seed(2026)
d <- data.frame(value=c(rnorm(20),rnorm(20,.4),rnorm(20,.8)), group=factor(rep(c("A","B","C"),each=20)))
d<-droplevels(subset(d,group!="C"));print(coin::conover_test(value~group,data=d,distribution="asymptotic"))
"""
# No shell interpolation. A failed R execution raises an error in Python.
result = subprocess.run([rscript, "--vanilla", "-"], input=r_code,
                        text=True, capture_output=True)
print(result.stdout)
if result.stderr:
    print(result.stderr)
result.check_returncode()
R

Validated — Executed successfully in the validation environment · needs coin

set.seed(2026)
d <- data.frame(value=c(rnorm(20),rnorm(20,.4),rnorm(20,.8)), group=factor(rep(c("A","B","C"),each=20)))
d<-droplevels(subset(d,group!="C"));print(coin::conover_test(value~group,data=d,distribution="asymptotic"))
Output
	Asymptotic Two-Sample Conover-Iman Test

data:  value by group (A, B)
Z = -0.27256, p-value = 0.7852
alternative hypothesis: true ratio of scales is not equal to 1

Sources

Statistics guide v4 (historical):
Python: Executed end to end through Rscript · R: Executed successfully in the validation environment
Reference's record:
Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Python-to-R bridge; Rscript is unavailable. R code was not executed. Python: Not run in the reference's review: Python-to-R bridge; Rscript is unavailable. R code was not executed. R: Reviewed but not run: R wasn't available to the reference's authors.

From the CodeSplash statistics guide (v4), entry 100, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT100.