Assumption · Statistics Library

Homogeneity of variance (homoscedasticity)

Homogeneity of variance is the assumption that the groups being compared have the same spread, not just the same center.

Topic indexA reference reading outside the guided chapter sequence

Understand the idea

Some tests combine the groups' spreads into a single pooled estimate of 'how noisy is this measurement'. That only makes sense if the groups really are equally noisy. Equal spreads are called homoscedasticity; unequal spreads are called heteroscedasticity.

Picture two machines making the same part. Both average 10 mm, but one is consistent to within 0.01 mm and the other wanders by 0.5 mm. Averaging their variability into one number describes neither machine.

When spreads differ a lot AND the groups are different sizes, a test that pools them can be badly wrong: it will report significant differences more often than it should, or less often, depending on whether the bigger group is the noisier one. The fix is usually not to transform anything: it is to use a method that does not pool, like Welch's t-test, which KernelStats already uses by default.

Practitioner explanation

The pooled-variance estimator s_p^2 is a weighted average of the group variances, valid as an estimate of a COMMON sigma^2. Under heteroscedasticity it estimates nothing meaningful, and the resulting t or F statistic no longer follows its nominal reference distribution.

Severity depends on the pairing of variance with group size. With equal n the pooled t is fairly robust to variance ratios up to about 4:1. With unequal n it is not: when the SMALLER group has the LARGER variance the test is liberal (true Type I error well above alpha), and when the larger group has the larger variance it is conservative and loses power. This interaction, not the variance ratio alone, is what makes the assumption matter.

The practical response is to choose a method that does not assume it (Welch's t, Welch's ANOVA, or heteroscedasticity-consistent standard errors in regression) rather than to pre-test and branch. Pre-testing variances and then selecting the test conditions the analysis on the data and inflates the overall error rate, which is why KernelStats defaults to Welch instead of running that two-stage procedure.

When to use it

Consider it when

Check it when you have deliberately chosen a pooled-variance method: Student's (equal-variance) two-sample t, classical one-way ANOVA, or an OLS model whose residual plot you have not yet examined.

Use caution when

Do not pre-test it in order to choose between Welch's and Student's t. That branch inflates the Type I error rate of the combined procedure; use the method that does not assume equal variance from the start.

Formulas and symbols

Pooled variance

sp2=(n1−1)s12+(n2−1)s22n1+n2−2s_p^2 = \frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1 + n_2 - 2}

The quantity that is only meaningful when a common variance actually exists.

Levene / Brown-Forsythe statistic

W=(N−k)(k−1)⋅∑ini(zˉi−zˉ)2∑i∑j(zij−zˉi)2W = \frac{(N-k)}{(k-1)} \cdot \frac{\sum_i n_i (\bar{z}_i - \bar{z})^2}{\sum_i \sum_j (z_{ij} - \bar{z}_i)^2}

z_ij is the absolute deviation of each observation from its group mean (Levene) or group median (Brown-Forsythe, more robust). k groups, N observations total.

Alternatives

  • Two-Sample t-Test. Two groups with unequal spreads: keep the default, which does not assume equal variances, and Welch's t handles it directly.
  • Mann-Whitney U Test. Spreads differ AND normality is also doubtful at small n. Note this changes the hypothesis being tested from means to stochastic ordering.

Worked example

Scenario

Comparing a response across two groups where group A has 20 observations with SD 6.0 and group B has 80 observations with SD 2.0: the SMALLER group is the noisier one, which is the dangerous pairing.

Result

Levene's test flags unequal variance. Student's pooled t would use a common SD of 3.19 and n1 + n2 - 2 = 98 degrees of freedom; Welch's t uses 20.1.

Interpretation

The pooled test averages the two variances into 3.19, which badly understates the noise in the small group that dominates the standard error, and it then claims 98 degrees of freedom. Welch's 20.1 is the honest accounting, and the gap between 98 and 20 is why this pairing makes the pooled test liberal: it rejects the null far more often than its stated 5%. Report the Welch result and note that variances were unequal.

Common misconceptions

Misconception

A significant Levene's test means you must transform the data.

Correction

It means a pooled-variance method is inappropriate. Switching to a method that allows unequal variances (Welch) preserves the original scale and the interpretability of the result; transforming changes the quantity being compared and is a heavier intervention than the problem usually requires.

Misconception

A non-significant Levene's test proves the variances are equal.

Correction

It shows the data do not distinguish them, which is routine at small n where the test has little power. This is exactly why pre-testing is a poor basis for choosing the main analysis.

References

  1. NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.5.10 Levene test for equality of variances, NIST/SEMATECH (2012), §1.3.5.10.