Sub topic 8
Checking Whether Variances Are Equal
Assume you know basic descriptive statistics, DMAIC, histograms, box plots, and the difference between a sample and a population. This chapter focuses on one assumption used when comparing group means: whether the groups have similar spread.
Variance measures how far observations tend to lie from their group mean. Equal variance means that the groups have roughly similar spread, even if their means differ. This condition is also called homogeneity of variance or homoscedasticity.
For example, suppose a Six Sigma team compares cycle time on two production lines. The question is not only whether the average cycle times differ. The team should also ask whether one line produces much more variable cycle times than the other.
Why equal variance matters
Many classical tests use a pooled estimate of variation. This estimate combines the group variances into one value. Pooling is reasonable when the group spreads are similar.
If the variances differ greatly, especially when group sizes also differ, a pooled test can produce an unreliable p-value. The test may report a difference when none exists or fail to detect a real difference.
The hypotheses for an equal-variance check are:
- Null hypothesis, \(H_0\): the population variances are equal.
- Alternative hypothesis, \(H_A\): at least one population variance differs.
A common significance level is \(\alpha = 0.05\).
Use Levene’s test
Levene’s test evaluates whether several groups have equal variance. The test first measures how far each observation is from its group center, then compares those distances across groups.
The standard version uses the mean as the center. The median-centered version, often called the Brown–Forsythe test, is less sensitive to outliers and skewed data. It is a useful default for process data.
| Result | Interpretation | Usual action |
|---|---|---|
| p-value greater than α | Insufficient evidence that variances differ | Equal variance remains plausible |
| p-value less than or equal to α | Evidence that variances differ | Use a method that does not require equal variance |
A large p-value does not prove that the variances are equal. It means that the sample does not provide strong evidence of a difference.
import numpy as np
from scipy import stats
rng = np.random.default_rng(42)
line_a = rng.normal(loc=50.0, scale=2.0, size=30)
line_b = rng.normal(loc=51.5, scale=3.5, size=30)
# Median-centered Levene test, which is more robust to outliers
result = stats.levene(line_a, line_b, center="median")
alpha = 0.05
print("Levene statistic =", result.statistic)
print("p-value =", result.pvalue)
if result.pvalue <= alpha:
print("Evidence of unequal variances")
else:
print("Insufficient evidence of unequal variances")Connect the result to test selection
For a two-group comparison, Welch’s two-sample t-test is usually a safe choice when variances may differ. It does not require equal variances and adjusts the degrees of freedom. The degrees of freedom determine the reference distribution used to calculate the p-value.
Do not automatically switch to a pooled t-test because Levene’s test is not significant. Consider the group sizes, box plots, outliers, and process knowledge. A non-significant test may simply reflect a small sample.
For three or more groups, standard one-way ANOVA assumes equal variances. If that assumption is doubtful, consider Welch’s ANOVA or a rank-based alternative such as the Kruskal–Wallis test. The choice also depends on normality, sample size, and the question being asked.
Exercise
Two groups have a Levene test p-value of 0.018 with α = 0.05. Which conclusion and follow-up are appropriate?
Show answer
Reject the equal-variance assumption because 0.018 is less than 0.05. For a two-group mean comparison, use Welch’s t-test and investigate why the process spreads differ.