Skip to content

BCompare groups · Guide test 048

Ury–Wiggins–Hochberg test

Provides multiple pairwise comparisons of means with unequal variances.

Runs in CodeSplashPython (calls R) example not runR example not run 2 corrections in edition 2

Do it in CodeSplash

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

In One-way ANOVA (Welch / classic), choose Post hoc comparisons = Ury–Wiggins–Hochberg. In Pairwise comparisons (Tukey, Games–Howell, Dunnett, Dunn, Steel–Dwass …), choose Comparison = Ury–Wiggins–Hochberg.

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 · Ury–Wiggins–Hochberg test

4
10
0.65

Group i has true mean (i − 1) × spread.

2.50
0.050

Your data

Drag a point or use ↑/↓ to change it
Group 1mean 0.49Group 2mean 0.96Group 3mean 1.18Group 4mean 1.40

If H₀ were true

|t| = 1.14
  1. The reference: how |t| varies across samples when H₀ is true, the Bonferroni bound on 6 pairs, |t| df 11.8.
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = 1.000).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The whole family

PairDifference in means with 95% simultaneous intervalpp adj.
.4281.000
.3631.000
.2751.000
.7951.000
.6261.000
.8251.000

6 pairs; adjusted by Bonferroni. The highlighted row is the one in the reference pane (the most extreme by default).

The formula

padj=min⁡ ⁣(1, m pij),pij from Welch’s tp_{adj} = \min\!\left(1,\ m\,p_{ij}\right),\quad p_{ij}\ \text{from Welch's } t

With your numbers

∣t∣=1.14,m=6,padj=1|t| = 1.14,\qquad m = 6,\qquad p_{adj} = 1
mm
number of pairs
pijp_{ij}
two-sided Welch t p-value

The verdict

|t| = 1.14, p = 1.000, Δ = −0.91

p > α = .050: compatible with H₀

Effect size: Group 1 − Group 4 (difference in means) Δ = −0.909

Welch t per pair with a Bonferroni bound (Ury–Wiggins); Hochberg's step-up variant is a little more powerful.

Statistic
1.145
p-value
1.0000
Ury–Wiggins–Hochberg test on Group 1: n = 10; Group 2: n = 10; Group 3: n = 10; Group 4: n = 10: |t| = 1.14, p = 1.000, Δ = −0.91. The p-value is above α = .050, so the data are compatible with H0.

Ury–Wiggins–Hochberg test on Group 1: n = 10; Group 2: n = 10; Group 3: n = 10; Group 4: n = 10: |t| = 1.14, p = 1.000, Δ = −0.91. The p-value is above α = .050, so the data are compatible with H₀.

Question and hypotheses

H0ij: μi=μj for each pair of independent groups.

Assumptions

Independent groups and independent observations; approximately normal within group sampling for small sample inference; variances may differ.

Formula

tij=xˉi−xˉjai+ajνij=(ai+aj)2ai2/(ni−1)+aj2/(nj−1)ai=si2/ni\begin{gathered}t_{ij}=\frac{\bar x_i-\bar x_j}{\sqrt{a_i+a_j}}\\[5pt]\nu_{ij}=\frac{(a_i+a_j)^2}{a_i^2/(n_i-1)+a_j^2/(n_j-1)}\\[5pt] a_i=s_i^2/n_i\end{gathered}

Parameters and notation

k is the group count; ni, x̄i, si² are group summaries; m is the number of pairwise comparisons.

Structure of the method

Compute pairwise Welch t statistics and marginal p-values, then apply the explicitly selected multiplicity rule. The cited implementation labels Bonferroni-adjusted comparisons Ury–Wiggins and offers a Hochberg option. A Holm setting is a valid distinct adjustment of the same marginal tests, but it should not be mislabeled as either named option.

Estimated and nuisance parameters

Estimate group means, separate variances, and pair-specific degrees of freedom. The comparison family and its size are prespecified inputs. Adjustment ranks in a stepwise procedure are calculated from p-values; they are not newly fitted scientific effects or evidence that the smallest raw p-value was the most important planned contrast.

Settings and design choices

Choose Bonferroni, Hochberg, or another named adjustment explicitly, with familywise alpha and the full planned comparison family. Bonferroni and Holm work under arbitrary dependence given valid marginal p-values; Hochberg needs suitable dependence conditions. The method name and code option must agree in any reproducible report.

Fitting and adaptation

Refit all group summaries after data changes and rerun adjustment over the same stated family. Adding comparisons can change adjusted conclusions for existing pairs. For a new experimental design, validate the marginal Welch tests first; multiplicity adjustment cannot correct paired dependence, data-selected outcomes, or a misspecified mean estimand.

Sensitivity and robustness

Small-sample heteroskedastic approximations remain a limitation even when the adjustment theorem is valid. Excluding large p-values from the adjustment family is invalid unless the omitted hypotheses were outside the prespecified family. The baseline example's Holm option should be relabeled or changed to the documented Bonferroni Ury–Wiggins setting.

How to use and calibrate

Ury–Wiggins uses Bonferroni adjusted Welch p values; the cited combined implementation also offers a Hochberg step-up option. State the exact choice.

Example application

Compare treatment means when group variances and sample sizes differ.

Interpretation and pitfalls

Watch out

Hochberg step-up requires suitable dependence conditions; Bonferroni remains valid for arbitrary dependence given valid marginal p values.

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.
  • Rewritten in the review: Python code, R code.
  • Python codesearch.r-project.org

    Demonstrate the documented Ury–Wiggins option; the previous Holm setting was a differently adjusted Welch family.

    Corrected Python code
    # 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::uryWigginsHochbergTest(value~group,data=d,p.adjust.method="bonferroni"))
    """
    # 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 codesearch.r-project.org

    Demonstrate the documented Ury–Wiggins option; the previous Holm setting was a differently adjusted Welch family.

    Corrected R code
    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::uryWigginsHochbergTest(value~group,data=d,p.adjust.method="bonferroni"))
    

Python and R

Ury–Wiggins–Hochberg pairwise procedure with Holm adjustment explicitly selected. Read the adjusted p-value matrix, not unadjusted pairwise tests.

Python · invokes R

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::uryWigginsHochbergTest(value~group,data=d,p.adjust.method="holm"))
"""
# 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

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::uryWigginsHochbergTest(value~group,data=d,p.adjust.method="holm"))

Sources

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 048, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT048.