BCompare groups · Guide test 030
Mack–Wolfe umbrella test
Tests for an increase then decrease across ordered groups, with a known or estimated peak.
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 Alternative hypothesis = Rises to a peak, then falls (umbrella).
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 · Mack–Wolfe umbrella test
The group with the highest mean (and the peak the test is told).
Your data
Drag a point or use ↑/↓ to change itIf H₀ were true
- The reference: how z varies across samples when H₀ is true (normal approximation).
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .028).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- Mann–Whitney count of pairs where group b exceeds group a
- the peak group, fixed before looking
- A_p's null mean and variance
The verdict
A_p = 266.00, z = 1.91, p = .028
p ≤ α = .050: reject H₀
Jonckheere's idea bent at the peak: rising counts before it, falling counts after it. The peak must be named in advance; searching for it needs the permutation version.
- Statistic
- 1.905
- p-value
- 0.0284
Mack–Wolfe umbrella test on Group 1: n = 10; Group 2: n = 10; Group 3: n = 10; Group 4: n = 10: A_p = 266.00, z = 1.91, p = .028. The p-value is below α = .050, so the data are hard to reconcile with H₀.
Question and hypotheses
H0: equal locations; H1: locations increase up to a peak then decrease.
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
Uab counts observations in group b above group a; p is the hypothesized peak group. Null moments can be calculated from the conditional rank permutation distribution.
Structure of the method
For a specified peak group, combine increasing-order concordance counts on its left with decreasing-order counts on its right. Standardize with the corresponding null moments. If the peak is unknown and selected by maximizing a statistic, calibration must include the same maximization over all candidate peaks in every null replicate.
Estimated and nuisance parameters
Observed pairwise concordances and tie structures are computed from data. A known peak index is a fixed hypothesis input; an estimated peak is a data-selected feature whose uncertainty changes the null distribution. Group sizes influence the moments, so equal-size critical values cannot be transferred without justification.
Settings and design choices
Choose known versus unknown peak, candidate peak set, direction convention, alpha, tie handling, and permutation count. Restricting peaks based on independent scientific knowledge differs from restricting them after viewing responses. Record the factor ordering and ensure the software interprets the supplied peak index in that ordering.
Fitting and adaptation
Recompute the full umbrella statistic after sample updates. For an unknown-peak analysis, rerun peak selection inside each permutation or simulation rather than fixing the observed optimum. Adaptation to repeated-dose measurements requires a dependence-aware procedure; the independent-group umbrella test does not model individual response trajectories.
Sensitivity and robustness
Small groups, extensive ties, unequal allocation, and weakly separated peak locations can yield unstable peak estimates. A significant umbrella pattern is not proof that all left-side and right-side comparisons follow the ordering individually. Using a fixed-peak tail after searching peaks creates anti-conservative inference and should be avoided.
How to use and calibrate
For a fixed peak use the documented standardized approximation or permutation. For an unknown peak calibrate maxp Zp over all candidate peaks jointly.
Example application
Detect improvement at moderate doses followed by toxicity at high doses.
Interpretation and pitfalls
Watch out
Selecting the peak and using its fixed peak p value is invalid. Ties and unequal sample sizes affect 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
Groups are ordered A, B, C; declare the trend/umbrella direction before observing outcomes.
Not run — Python launcher syntax checked; R backend runtime not verified · needs Python standard library + Rscript; R packages: PMCMRplus
# 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(PMCMRplus::mackWolfeTest(value~group,data=d,p=2))
"""
# 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()
Not run — Syntax checked; runtime not verified in the final environment · needs PMCMRplus
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(PMCMRplus::mackWolfeTest(value~group,data=d,p=2))
Sources
- PMCMRplus — PMCMRplus · mackWolfeTestAuthor documentation/source reviewed: PMCMRplus 1.9.12.search.r-project.org
- mackWolfeTestsearch.r-project.org
- Statistics guide v4 (historical):
- Python: Python launcher syntax checked; R backend runtime not verified · R: Syntax checked; runtime not verified in the final 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 030, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT030.