ADescribe · Guide test 097
Mood scale test
Uses squared deviations of pooled ranks from their midpoint to compare two scales.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Equal spread tests — Do two or more groups have the same spread?
In Equal spread tests, choose Test = Mood scale test.
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 · Mood scale test
Alternative
Your data
Drag a point or use ↑/↓ to change itIf H₀ were true
- The reference: how z varies across samples when H₀ is true.
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .011).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- pooled ranks of the first group
- the middle rank
The verdict
Z = −2.53, z = −2.53, p = .011
p ≤ α = .050: reject H₀
Squared distance of ranks from the middle: large when the first group sits in both tails. Like Ansari–Bradley, it needs equal centers.
- Statistic
- −2.533
- p-value
- 0.0113
Mood scale test on Group 1: n = 20; Group 2: n = 20: Z = −2.53, z = −2.53, p = .011. The p-value is below α = .050, so the data are hard to reconcile with H₀.
Question and hypotheses
H0: the two population scales are equal.
Assumptions
Independent samples from distributions with a common location and comparable shape under a scale model; continuous observations for simple rank calibration. Location shifts can confound scale tests.
Formula
Parameters and notation
Ri are pooled ranks; large M indicates first-sample observations at extremes.
Structure of the method
Pool ranks, square their deviations from the pooled rank midpoint, and sum the scores for one sample. Extreme ranks receive larger scores, producing a two-sample scale contrast with a standardized normal or conditional-permutation reference under the appropriate common-location model.
Estimated and nuisance parameters
The estimated objects are ranks and their squared-distance score sum; score moments depend on sample sizes and ties. No Gaussian observation variance is estimated. The common location and shared distribution shape are substantive nuisance assumptions that distinguish a scale interpretation from general distributional difference.
Settings and design choices
Set alternative direction, tie treatment, calibration method, and any center adjustment in advance. The Mood scale test is unrelated to Mood’s median test. Centering observations separately must be documented and incorporated into any justified resampling rather than assumed to preserve exact rank calibration.
Fitting and adaptation
Recompute pooled ranks and null score moments after data changes. A conditional rank permutation is appropriate when the relevant null makes group labels exchangeable. Fine-tuning does not apply; a new measurement resolution changes ties and may require a different calibration assessment.
Sensitivity and robustness
Unequal locations can increase extreme-rank frequencies even when scales match. Squared rank scores emphasize tails without using their numerical distances, so a few extreme magnitudes do not carry unlimited leverage, but many ties or small samples still affect information and p-value accuracy.
How to use and calibrate
Standardize using permutation moments and use a normal or exact rank distribution.
Example application
Compare dispersion between two independent measurement processes.
Interpretation and pitfalls
Watch out
Do not interpret unequal locations as evidence of a scale difference. Estimated recentering changes finite sample calibration.
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
Continuous-data Mood scale example with distinct pooled observations. R and SciPy use different tie corrections for some tied datasets; do not expect matching tied-data p-values. Scale interpretation requires a common location.
Validated — Executed successfully in the validation environment · needs numpy, scipy
import numpy as np
from scipy import stats
rng = np.random.default_rng(2026)
x = np.array([4.2,5.1,5.4,4.8,6.0,5.8,4.9,5.6,6.2,5.0])
y = np.array([4.01,4.42,4.83,5.04,5.15,4.36,4.77,4.68,5.29,4.99])
print(stats.mood(x,y))
Output
SignificanceResult(statistic=np.float64(0.7650368522374495), pvalue=np.float64(0.44424960052300055))
Validated — Executed successfully in the validation environment · needs Base/standard library
x <- c(4.2,5.1,5.4,4.8,6.0,5.8,4.9,5.6,6.2,5.0)
y <- c(4.01,4.42,4.83,5.04,5.15,4.36,4.77,4.68,5.29,4.99)
print(mood.test(x,y))
Output
Mood two-sample test of scale data: x and y Z = 0.76504, p-value = 0.4442 alternative hypothesis: two.sided
Sources
- R stats — R stats · mood.teststat.ethz.ch
- mood.teststat.ethz.ch
- Statistics guide v4 (historical):
- R: Executed successfully in the validation environment
- Reference's record:
- Edition 2 review: Python: executed · R: not executed (Rscript unavailable). Python: Ran in the reference's review, on this exact code. R: Reviewed but not run: R wasn't available to the reference's authors.
From the CodeSplash statistics guide (v4), entry 097, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT097.