Skip to content

BCompare groups · Guide test 042

Dunnett test

Compares several treatment means with a common control using their joint distribution.

Runs in CodeSplashPython example validatedR example not run

Do it in CodeSplash

In the app, set it up in Analyze with one of these methods:

In Pairwise comparisons (Tukey, Games–Howell, Dunnett, Dunn, Steel–Dwass …), choose Comparison = Dunnett.

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 · Dunnett test

4
10
0.65

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

1.00
0.050

Your data

Drag a point or use ↑/↓ to change it
Group 1mean 0.49Group 2mean 0.88Group 3mean 1.23Group 4mean 1.73

If H₀ were true

|t| = 2.66
  1. The reference: how |t| varies across samples when H₀ is true, the largest of 3 correlated |t| (Dunnett, df 36).
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .031).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The whole family

PairDifference in means with 95% simultaneous intervalpp adj.
.412–
.120–
.012.031

3 comparisons with group 1 (the control); adjusted by Dunnett's multivariate t. The highlighted row is the one in the reference pane (the most extreme by default).

The formula

ti=xˉi−xˉ0MSE(1/ni+1/n0),p=P ⁣(max⁡j∣Tj∣≥∣ti∣)t_i=\dfrac{\bar x_i-\bar x_0}{\sqrt{\mathrm{MSE}(1/n_i+1/n_0)}},\quad p = P\!\left(\max_j |T_j| \ge |t_i|\right)

With your numbers

∣t∣=2.66,padj=0.03|t| = 2.66,\qquad p_{adj} = 0.03
xˉ0\bar x_0
the control group's mean (group 1 here)
TjT_j
correlated t statistics sharing the control

The verdict

|t| = 2.66, p = .031, Δ = 1.24

p ≤ α = .050: reject H₀

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

Only treatment-versus-control comparisons, so it is more powerful than Tukey for that family. The shared control correlates the comparisons; the maximum of the correlated |t| gives the adjusted p.

Statistic
2.659
p-value
0.0309
Dunnett test on Group 1: n = 10; Group 2: n = 10; Group 3: n = 10; Group 4: n = 10: |t| = 2.66, p = .031, Δ = 1.24. The p-value is below α = .050, so the data are hard to reconcile with H0.

Dunnett test on Group 1: n = 10; Group 2: n = 10; Group 3: n = 10; Group 4: n = 10: |t| = 2.66, p = .031, Δ = 1.24. The p-value is below α = .050, so the data are hard to reconcile with H₀.

Question and hypotheses

H0j: μj=μ0 for each treatment versus one prespecified control.

Assumptions

Independent normal errors with common variance in a one factor model; group sizes may differ. The family of comparisons must be specified.

Formula

tj=xˉj−xˉ0sp1/nj+1/n0ρij=1/n0(1/ni+1/n0)(1/nj+1/n0)\begin{gathered}t_j=\frac{\bar x_j-\bar x_0}{s_p\sqrt{1/n_j+1/n_0}}\\[5pt] \rho_{ij}=\frac{1/n_0}{\sqrt{(1/n_i+1/n_0)(1/n_j+1/n_0)}}\end{gathered}

Parameters and notation

sp²=MSE; joint t degrees of freedom are N−k. Correlations reflect the shared control.

Structure of the method

Fit a common-variance model and form each treatment-minus-control contrast. Shared control observations induce positive covariance among contrasts, so the maximum of a correlated multivariate t vector supplies simultaneous calibration. The dependence structure is used directly rather than treating the comparisons as independent or applying an all-pairs range indiscriminately.

Estimated and nuisance parameters

Estimate group means and pooled residual variance. Group sample sizes determine the correlation matrix of standardized contrasts; the control identity, included treatments, and comparison direction are fixed design choices. Numerical multivariate-t integration estimates tail probabilities computationally, not additional population parameters.

Settings and design choices

Prespecify control, one- or two-sided alternatives, familywise alpha, and numerical integration precision or random-state settings where exposed. Selecting the best observed group as 'control' changes the inferential problem. If multiple endpoints or control families are analyzed, the scope of simultaneous protection must be expanded or clearly bounded.

Fitting and adaptation

Refit the common model and rebuild contrast covariance when group sizes or observations change. New candidate treatments enlarge the comparison family and require new critical values. For unequal variances or correlated units, use a justified generalized simultaneous-contrast model rather than assuming the original pooled-variance Dunnett law continues to apply.

Sensitivity and robustness

A very small control group makes every comparison imprecise and highly dependent. Numerical integration can produce small run-to-run p-value differences unless controlled. Common-variance misspecification affects the entire family. Dunnett's many-to-one procedure is distinct from Dunnett T3's unequal-variance all-pairs approximation despite the shared surname.

How to use and calibrate

Use the multivariate t maximum distribution for one or two sided simultaneous inference.

Example application

Compare several candidate interventions with one standard treatment.

Interpretation and pitfalls

Watch out

Dunnett’s original common variance control comparison is different from Dunnett T3 all pair comparisons.

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

A is the prespecified common control; familywise error is controlled across treatment-versus-control contrasts.

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)
groups = [rng.normal(m,1,20) for m in (0,.4,.8)]
print(stats.dunnett(groups[1],groups[2],control=groups[0]))
Output
Dunnett's test (95.0% Confidence Interval)
Comparison               Statistic  p-value  Lower CI  Upper CI
 (Sample 0 - Control)      2.338     0.042     0.021     1.393
 (Sample 1 - Control)      4.888     0.000     0.792     2.164
R

Not run — Syntax checked; runtime not verified in the final environment · needs DescTools

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(DescTools::DunnettTest(value~group,d,control="A"))

Sources

Statistics guide v4 (historical):
R: Syntax checked; runtime not verified in the final 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 042, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT042.