BCompare groups · Guide test 027
Savage scores test
Compares groups using exponential scores, emphasizing differences toward the upper end of the distribution.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Kruskal–Wallis test — Do three or more independent groups differ in location (without assuming normality)?
In Kruskal–Wallis test, choose Rank scores = Savage (exponential) scores.
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 · Savage scores test
Group i has true mean (i − 1) × spread.
Your data
Drag a point or use ↑/↓ to change itIf H₀ were true
- The reference: how T 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 = .091).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- Savage (exponential) scores, large for the largest ranks
The verdict
T(2) = 4.79, p = .091
p > α = .050: compatible with H₀
Optimal for exponential-type data and scale shifts in lifetimes; the rank analog of the log-rank test without censoring.
- Statistic
- 4.786
- p-value
- 0.0914
Savage scores test on Group 1: n = 10; Group 2: n = 10; Group 3: n = 10: T(2) = 4.79, p = .091. The p-value is above α = .050, so the data are compatible with H₀.
Question and hypotheses
H0: independent samples have identical distributions; alternative: a systematic shift in exponential scores.
Assumptions
Independent observations and independent groups; ordinal or quantitative measurements. The permutation null is identical group distributions. A location or median interpretation additionally needs comparable distribution shapes.
Formula
Parameters and notation
Ranks increase with observations; the displayed scores have pooled mean zero. For tied ranks average the corresponding scores.
Structure of the method
Replace pooled ranks with centered exponential-order scores and form a group score-sum statistic or its omnibus quadratic version. The increasing score sequence emphasizes upper observations. Under fixed group sizes and identical distributions, conditional permutation supplies the null distribution; a covariance-based chi-square limit supports larger samples.
Estimated and nuisance parameters
Computed quantities include pooled ranks, tie-averaged scores, group score totals, and the conditional covariance. The exponential score function is fixed by the test and does not mean an exponential distribution has been fitted to the observations. Group size and the scientific direction are design quantities.
Settings and design choices
Choose a directional two-sample or omnibus multi-group test, tie-score averaging, exact/Monte Carlo/asymptotic distribution, alpha, and the multiplicity family. If upper-tail emphasis is scientifically motivated, record that before analysis. Reversing the score convention reverses directional interpretation and should be checked against software output.
Fitting and adaptation
Rebuild pooled ranks and tied-score averages after any data change. In a custom permutation implementation, hold observed scores fixed and permute only labels allowed by the design. For censored lifetimes, use a censoring-aware survival procedure rather than treating censoring times as fully observed values in this ordinary rank test.
Sensitivity and robustness
A handful of highest ranks can drive the result, so compare the substantive tail patterns with the test's intended alternative. Heavy ties reduce score resolution. Monotone transformations preserve order but not the scientific meaning of an exponential-type alternative; this is a score test for distributional ordering, not a proof of an exponential data model.
How to use and calibrate
Use the rank permutation distribution or an asymptotic χ²k−1 quadratic score test. Two sample directional versions use a standardized score sum.
Example application
Compare positive lifetimes when an exponential type shift/scale alternative is plausible.
Interpretation and pitfalls
Watch out
The name also covers differently oriented score conventions. Check the direction of large scores and the exact implementation.
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
Ranks/scores use all observations pooled across independent groups; the omnibus p-value is not a pairwise conclusion.
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)))
print(coin::savage_test(value~group,data=d))
"""
# 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()
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)))
print(coin::savage_test(value~group,data=d))
Output
Asymptotic K-Sample Savage Test data: value by group (A, B, C) chi-squared = 9.5222, df = 2, p-value = 0.008556
Sources
- coin — coin · savage_testAuthor documentation/source reviewed: coin 1.4-6.search.r-project.org
- LocationTestssearch.r-project.org
- savage_testsearch.r-project.org
- 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 027, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT027.