Skip to content

ADescribe · Guide test 097

Mood scale test

Uses squared deviations of pooled ranks from their midpoint to compare two scales.

Runs in CodeSplashPython example validatedR example validated

Do it in CodeSplash

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

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

20
20
0.00
1.0
2.0
0.050

Alternative

Your data

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

If H₀ were true

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

The formula

T=∑i∈x(ri−N+12)2,Z=T−E[T]Var TT = \sum_{i\in x}\left(r_i-\tfrac{N+1}{2}\right)^2,\qquad Z = \dfrac{T-E[T]}{\sqrt{\mathrm{Var}\,T}}

With your numbers

Z=(−2.53)Z = (-2.53)
rir_i
pooled ranks of the first group
N+12\tfrac{N+1}{2}
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 H0.

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

M=∑i∈X[Ri−(N+1)/2]2M=\sum_{i\in X}[R_i-(N+1)/2]^2

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.

Python · native

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))
R

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

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.