Dunnett's Test
Calculator
Learn More
Dunnett's Test
Definition
Dunnett's Test is a multiple comparison procedure used to compare several treatments against a single control group. It maintains the family-wise error rate while providing more statistical power than methods that compare all pairs.
Formula
Test Statistic:
Where:
- = mean of treatment group
- = mean of the control group
- = sample size of treatment group
- = sample size of the control group
- = standard error of the mean
The standard error of the mean is calculated as:
Where is the pooled variance, combining the variances of all groups:
In ANOVA, the pooled variance corresponds to the within-group variance:
Key Assumptions
Independence: Observations must be independent
Normality: Data within each group should be normally distributed
Homogeneity of Variance: Groups should have equal variances
Practical Example
Step 1: State the Data
Group | Data | N | Mean | SD |
---|---|---|---|---|
Control | 8.5, 7.8, 8, 8.2, 7.9 | 5 | 8.08 | 0.27 |
Treatment A | 9.1, 9.3, 8.9, 9, 9.2 | 5 | 9.10 | 0.16 |
Treatment B | 7.2, 7.5, 7, 7.4, 7.3 | 5 | 7.28 | 0.19 |
Treatment C | 10.1, 10.3, 10, 10.2, 9.9 | 5 | 10.10 | 0.16 |
Step 2: State Hypotheses
For each treatment group i vs control:
Step 3: Calculate SS and MSE
- with
- with
Step 4: Calculate Test Statistics
For each treatment vs control:
- Treatment A:
- Treatment B:
- Treatment C:
Step 5: Compare with Critical Value
Critical value for , treatments, :
Compare with critical value:
- Treatment A: (Significant)
- Treatment B: (Significant)
- Treatment C: (Significant)
Step 6: Draw Conclusions
All treatments show significant differences from the control group ():
- Treatment A significantly increases response
- Treatment B significantly decreases response
- Treatment C shows largest significant increase
Code Examples
R
1library(multcomp)
2library(tidyverse)
3# Data preparation
4df = tibble(
5 Group = rep(c("Control", "Treatment A", "Treatment B", "Treatment C"), each = 5),
6 Response = c(8.5, 7.8, 8, 8.2, 7.9,
7 9.1, 9.3, 8.9, 9, 9.2,
8 7.2, 7.5, 7, 7.4, 7.3,
9 10.1, 10.3, 10, 10.2, 9.9)
10)
11
12# multcom package requires the Group variable to be a factor
13df$Group <- as.factor(df$Group)
14
15# Perform one-way ANOVA
16model <- aov(Response ~ Group, data = df)
17
18# Perform Dunnett's test
19dunnett_test <- glht(model, linfct = mcp(Group = "Dunnett"))
20summary(dunnett_test)
Python
1import numpy as np
2from statsmodels.stats.multicomp import pairwise_tukeyhsd
3import pandas as pd
4
5# Create example data
6data = pd.DataFrame({
7 'Response': [8.5, 7.8, 8.0, 8.2, 7.9, # Control
8 9.1, 9.3, 8.9, 9.0, 9.2, # Treatment A
9 7.2, 7.5, 7.0, 7.4, 7.3, # Treatment B
10 10.1, 10.3, 10.0, 10.2, 9.9], # Treatment C
11 'Group': np.repeat(['Control', 'Treatment A',
12 'Treatment B', 'Treatment C'], 5)
13})
14
15# Perform multiple pairwise comparisons using Tukey's test
16# (Note: Dunnett's test focuses only on comparisons against a control group,
17# but statsmodels does not provide a direct implementation of Dunnett's test.)
18results = pairwise_tukeyhsd(data['Response'],
19 data['Group'])
20
21print(results)
Alternative Tests
- Tukey's HSD: When comparing all groups to each other
- Bonferroni: When a simpler but more conservative approach is needed
- Games-Howell: When variances are unequal
Related Calculators
One-Way ANOVA Calculator
Tukey's HSD Test Calculator
Two-Way ANOVA Calculator
Effect Size Calculator
Help us improve
Found an error or have a suggestion? Let us know!