Levene's test checks whether two or more groups have equal variances (homogeneity of variance). It is the standard way to verify the equal-variance assumption that underlies tests like the standard One-Way ANOVA and the pooled-variance t-test. The robust median-centered variant is known as the Brown-Forsythe test.
💡 When to Use:Run Levene's test before a standard ANOVA or pooled t-test to check the equal-variance assumption. If Levene's test is significant (p < 0.05), the variances differ — switch to a variance-robust procedure such asWelch's ANOVAinstead.
Ready to test for equal variances? to see how it works, or upload your own data to discover if your groups truly have equal spread.
Levene's test assesses the null hypothesis that two or more groups have equal population variances (homogeneity of variance). It works by running a one-way ANOVA on the absolute deviations of each observation from its group center. When you center on the group median, the procedure is called the Brown-Forsythe test, which is more robust to non-normal data and is the recommended default.
| Center | Name | Best For |
|---|---|---|
| Median | Brown-Forsythe | Skewed or non-normal data (recommended) |
| Mean | Original Levene | Approximately symmetric, normal data |
| Trimmed mean | Trimmed Levene | Heavy-tailed distributions |
Each value is transformed into its absolute distance from its group center. Levene's statistic W is the F-ratio from a one-way ANOVA on these absolute deviations: if the spread differs across groups, the mean absolute deviations will differ too.
where is the absolute deviation of observation j in group i from that group's center , is the number of groups, and is the total sample size.
Null Hypothesis (H₀):
All group variances are equal
Alternative Hypothesis (H₁):
At least one group variance differs
library(car)
group <- factor(c(rep("A", 8), rep("B", 8), rep("C", 8)))
value <- c(10, 11, 9, 12, 10, 11, 9, 10,
5, 20, 8, 25, 3, 18, 7, 22,
14, 15, 13, 16, 14, 15, 13, 14)
data <- data.frame(group, value)
# Brown-Forsythe (median-centered) Levene's test — the recommended default
leveneTest(value ~ group, data = data, center = median)
# Original Levene's test (mean-centered)
leveneTest(value ~ group, data = data, center = mean)from scipy import stats
group_A = [10, 11, 9, 12, 10, 11, 9, 10]
group_B = [5, 20, 8, 25, 3, 18, 7, 22]
group_C = [14, 15, 13, 16, 14, 15, 13, 14]
# Brown-Forsythe (median-centered) — robust, recommended default
W, p_value = stats.levene(group_A, group_B, group_C, center='median')
print(f'Levene W: {W:.4f}')
print(f'p-value: {p_value:.4f}')
# Original Levene's test (mean-centered)
W_mean, p_mean = stats.levene(group_A, group_B, group_C, center='mean')
print(f'Levene W (mean): {W_mean:.4f}, p: {p_mean:.4f}')Levene's test tells you whether the equal-variance assumption holds:
Consider these alternatives in specific situations:
Levene, H. (1960). Robust tests for equality of variances. In I. Olkin (Ed.), Contributions to Probability and Statistics: Essays in Honor of Harold Hotelling (pp. 278–292). Stanford University Press.
Brown, M. B., & Forsythe, A. B. (1974). Robust tests for the equality of variances. Journal of the American Statistical Association, 69(346), 364–367.
What is the difference between Levene's test and the Brown-Forsythe test?
They are the same procedure with a different center. The original Levene's test centers on the group mean, while the Brown-Forsythe test centers on the group median, making it more robust to non-normal data.
What does a significant Levene's test mean?
A significant result (p < α) means the group variances are not equal, so the homogeneity-of-variance assumption is violated. Use a variance-robust test such as Welch's ANOVA instead of standard ANOVA.
Which center method should I choose?
The median (Brown-Forsythe) is recommended for most situations because it is robust to non-normality. Use the mean only when you are confident the data are approximately normal, and the trimmed mean for heavy-tailed distributions.