Course contentsShow
← Data Science
Lesson 380 of 2,14510. Hypothesis Tests for MeansFree lesson

Testing Equal Variances: Levene's and Bartlett's Tests

Using statistical tests to determine if the equal variance assumption holds for your groups.

Testing Equal Variances: Levene's and Bartlett's Tests

What You'll Learn

You'll learn how to use statistical tests to check whether groups have equal variances before running pooled t-tests.

Why Test for Equal Variances?

Remember from earlier lessons that some t-tests (like the pooled variance t-test) assume your groups have equal variances—the homoscedasticity assumption. Before choosing between a pooled t-test and Welch's t-test, you should verify whether this assumption holds. That's where Levene's and Bartlett's tests come in.

How These Tests Work

Both tests follow the hypothesis testing framework:

  • H₀ (Null Hypothesis): All groups have equal variances
  • H₁ (Alternative Hypothesis): At least one group has a different variance

If you get a small p-value (typically < 0.05), you reject the null and conclude the variances are not equal. If the p-value is large, you fail to reject—the equal variance assumption seems reasonable.

Levene's Test vs. Bartlett's Test

Levene's Test is more robust to departures from normality. It works by comparing the absolute deviations from group medians (or means). Think of it as the safe, general-purpose option.

Bartlett's Test is more powerful when your data is truly normal, but it's very sensitive to non-normality—it might reject equal variances simply because your data isn't perfectly bell-shaped, not because variances actually differ.

Practical Guidance

  • If your data looks reasonably normal, either test works
  • If you're unsure about normality, use Levene's test
  • If Levene's/Bartlett's rejects equal variances → use Welch's t-test
  • If equal variances seem reasonable → pooled t-test is fine

Key Takeaway: Levene's and Bartlett's tests help you decide between pooled and Welch's t-tests by formally testing whether groups have equal variances; Levene's is preferred when normality is questionable.