This calculator helps you perform comprehensive pairwise comparisons between all group means after obtaining a significant ANOVA result. Tukey's HSD (Honestly Significant Difference) test is the gold standard for systematically examining every possible group pair while maintaining strict control over the familywise error rate, ensuring your findings are both thorough and statistically sound.
What You'll Get:
- Complete Pairwise Analysis: Every possible group comparison with adjusted p-values and effect sizes
- ANOVA Integration: Full ANOVA results plus detailed post-hoc comparisons in one analysis
- Effect Size Metrics: Cohen's d for each comparison to assess practical significance
- Visual Insights: Significance matrix, group comparison charts, and distribution plots
- Assumption Validation: Comprehensive normality and homogeneity of variance testing
- CLD Notation: Critical Difference Letters to clearly identify which groups differ significantly
- Professional Reporting: APA-formatted results with effect sizes ready for publication
π‘ Pro Tip: Use Tukey's HSD when you want to compare all groups to each other. If you only need to compare treatments to a control group, use ourDunnett's Test Calculatorfor more focused analysis. Always ensure your ANOVA is significant first!
Ready to discover which groups truly differ? Load long format sample or load wide format sample to see how it works, or upload your own data to uncover the specific patterns of differences across all your groups.
Calculator
1. Load Your Data
2. Select Data Format & Options
Related Calculators
Learn More
Tukey's HSD Test
Definition
Tukey's HSD (Honestly Significant Difference) Test is a post-hoc test used after ANOVA to determine which specific groups differ from each other. It controls the family-wise error rate while conducting multiple pairwise comparisons.
Formula
Test Statistic:
Where:
- = studentized range statistic
- = Mean Square Error from ANOVA, which is equivalent to Mean Square Within ()
- = sample size per group
- = number of groups
- = total sample size
Key Assumptions
Practical Example
Step 1: State the Data
Comparing three fertilizer treatments on plant growth (cm):
| Treatment A | Treatment B | Treatment C |
|---|---|---|
| 25 | 42 | 35 |
| 30 | 38 | 33 |
| 28 | 40 | 31 |
| 32 | 45 | 34 |
| 29 | 41 | 32 |
Step 2: Calculate Group Statistics
- Treatment A: ,
- Treatment B: ,
- Treatment C: ,
- MSE (from ANOVA) =
Step 3: Calculate HSD
For , groups, :
Step 4: Compare Group Differences
(significant)
(significant)
(significant)
Step 5: Draw Conclusions
All pairwise comparisons show significant differences at . Treatment B produced significantly higher growth than both A and C, and Treatment C produced significantly higher growth than Treatment A.
Alternative Tests
Consider these alternatives:
- Bonferroni Test: More conservative, controls family-wise error rate
- ScheffΓ©'s Test: More flexible for complex comparisons
- Games-Howell Test: When variances are unequal
How to perform Tukeys HSD Test in R
Use TukeyHSD() function from base R or emmeans package for more advanced options including compact letter display (CLD).
library(emmeans)
library(tidyverse)
library(multcomp)
data <- tibble(
group = rep(c("A", "B", "C"), each = 5),
values = c(25, 30, 28, 32, 29, # Group A
42, 38, 40, 45, 41, # Group B
35, 33, 31, 34, 32) # Group C
) |>
mutate(group = as.factor(group))
data |>
group_by(group) |>
summarize(mean = mean(values), sd = sd(values), n = n())
aov_model <- aov(values ~ group, data = data)
summary(aov_model)
q <- qtukey(0.95, nmeans = 3, df = 12)
mse <- summary(aov_model)[[1]]["Residuals", "Mean Sq"]
hsd <- q * sqrt(mse / 5)
print(hsd)
emmeans_result <- emmeans(aov_model, "group")
pairs(emmeans_result, adjust = "tukey")
emmeans(aov_model, specs = ~ group) |>
cld()How to perform Tukeys HSD Test in Python
Use pairwise_tukeyhsd() function from statsmodels package to perform Tukey's HSD test in Python.
import pandas as pd
from statsmodels.stats.multicomp import pairwise_tukeyhsd
# Example data
group1 = [25, 30, 28, 32, 29]
group2 = [42, 38, 40, 45, 41]
group3 = [35, 33, 31, 34, 32]
# Create DataFrame
data = pd.DataFrame({
'values': group1 + group2 + group3,
'group': ['A']*5 + ['B']*5 + ['C']*5
})
# Perform Tukey's HSD
tukey = pairwise_tukeyhsd(
endog=data['values'],
groups=data['group'],
alpha=0.05
)
print(tukey)
# There is no package that provides CLD in Python similar to R's multcomp::cld()
# However, our calculator provides the same CLD output as R's multcomp::cld() with emmeans.