Sub topic 11
Comparing Three or More Means with ANOVA
When ANOVA fits
This chapter assumes you know basic descriptive statistics, histograms, box plots, samples, populations, and the DMAIC cycle. In the Analyze phase, use a hypothesis test when a process question requires evidence beyond observed sample differences.
Use one-way analysis of variance (ANOVA) when:
- The response, or Y, is continuous.
- One categorical input, or X, divides observations into three or more independent groups.
- You want to compare the group means.
For example, a team may compare cycle time across three production lines. The question is whether the lines have the same average cycle time or whether at least one line differs.
ANOVA tests these hypotheses:
- Null hypothesis, H₀: all population means are equal.
- Alternative hypothesis, H₁: at least one population mean differs.
The alternative does not say that every mean differs. It only says that the equality claim is unlikely.
How the F statistic works
ANOVA compares two kinds of variation:
- Between-group variation: how far the group means are from the overall mean.
- Within-group variation: how much observations vary inside each group.
The F statistic is:
F = between-group variation / within-group variation
A large F value means that group means are separated more than you would expect from ordinary variation within groups. The p-value measures how unusual an F value at least this large would be if H₀ were true.
Choose a significance level, commonly α = 0.05, before analyzing the data. If p < α, reject H₀ and conclude that the data provide evidence that at least one group mean differs. If p ≥ α, do not reject H₀. This does not prove that all means are equal.
Assumptions and common errors
A standard one-way ANOVA assumes:
- Observations are independent.
- The response is approximately normally distributed within each group.
- The groups have approximately equal variances.
Check these assumptions with the study design, plots, and suitable tests. A large outlier or a strong difference in group spread can distort the F statistic. If variances differ, consider Welch’s ANOVA. If the distributions are strongly non-normal or ordinal, consider the Kruskal-Wallis test.
The following example compares three production lines. The data are simulated, so the result demonstrates the method rather than a real process conclusion.
import numpy as np
from scipy import stats
rng = np.random.default_rng(7)
line_a = rng.normal(100, 5, 25)
line_b = rng.normal(102, 5, 25)
line_c = rng.normal(105, 5, 25)
f_stat, p_value = stats.f_oneway(line_a, line_b, line_c)
print("F =", f_stat)
print("ANOVA p =", p_value)
if p_value < 0.05:
print("Evidence that at least one line mean differs")
else:
print("Insufficient evidence that line means differ")Reporting the result
Report the group means and sample sizes, the F statistic, degrees of freedom, p-value, assumption checks, and an effect size when possible. Also state which groups differ in the follow-up comparison. A statistically significant difference may be too small to affect customers or process performance, so compare it with the project’s practical target.
Exercise
Three groups have means of 10, 10.4, and 10.6. The one-way ANOVA returns p = 0.03 at α = 0.05. What can you conclude?
Show answer
Reject the null hypothesis of equal means. The data provide evidence that at least one population mean differs, but ANOVA alone does not show which groups differ or whether the difference is practically important.