Levene’s Test for Homogeneity of Variances
F-testRun Levene’s test (and its Brown–Forsythe median-based variant) to check whether multiple groups have equal variances. Paste your data for 2 or more groups and get the F statistic, degrees of freedom, p-value and an interpretation at your chosen significance level.
Designed for teaching, lab work and quick checks of the equal-variance assumption before t-tests and ANOVA. For critical decisions, consult a statistician and your field’s reporting standards.
Interactive Levene’s test calculator
Median is recommended for robustness to outliers and non-normality.
Used to decide whether to reject equal variances.
Between 2 and 8 groups. Each needs at least 2 observations.
Paste one group per box. You can use commas, semicolons, spaces, or line breaks (e.g. 12.4, 11.9, 13.2 12.8).
What is Levene’s test?
Levene’s test is a widely used omnibus test of equality of variances across two or more groups. It tests the null hypothesis
It works by transforming the original observations \(X_{ij}\) into absolute deviations from a group-specific center \(T_i\):
Then a standard one-way ANOVA is run on the \(Z_{ij}\). If the mean (or median) absolute deviations differ substantially between groups, the test statistic becomes large and the p-value becomes small.
Mean vs. median (Brown–Forsythe) Levene’s test
The choice of center \(T_i\) defines several variants:
- Mean-based Levene’s test: \(T_i = \bar{X}_i\), the sample mean of group \(i\). This is the original version and is efficient when data are approximately normal.
- Median-based (Brown–Forsythe) test: \(T_i = \tilde{X}_i\), the sample median of group \(i\). This version is more robust to outliers and skewed distributions.
Many contemporary references recommend the median-based variant whenever normality is questionable. This calculator offers both, with the median version selected by default.
How the F statistic is computed
After computing the deviations \(Z_{ij}\) for each observation in group \(i\), let \(\bar{Z}_i\) be the mean of group \(i\), and \(\bar{Z}\) the overall mean:
Between-group sum of squares:
\[ SS_B = \sum_{i=1}^k n_i(\bar{Z}_i - \bar{Z})^2 \]Within-group sum of squares:
\[ SS_W = \sum_{i=1}^k \sum_{j=1}^{n_i} (Z_{ij} - \bar{Z}_i)^2 \]Degrees of freedom:
\[ df_B = k - 1, \qquad df_W = N - k \]Mean squares and Levene’s F statistic:
\[ MS_B = \frac{SS_B}{df_B}, \quad MS_W = \frac{SS_W}{df_W}, \quad F = \frac{MS_B}{MS_W}. \]Under \(H_0\) (equal variances), and assuming independent observations and mild regularity conditions, the F statistic approximately follows an \(F(df_B, df_W)\) distribution. The p-value is then:
When should you use Levene’s test?
- Before running a t-test or ANOVA, to assess whether the assumption of equal variances across groups is reasonable.
- In experimental design and quality control, to check stability of variability across conditions, treatments, or production lines.
- As part of model diagnostics when comparing residual spreads across categories.
Remember that a non-significant Levene’s test does not prove that the variances are exactly equal—it only indicates that the data are compatible with homogeneity at the chosen significance level.
Practical tips and caveats
- Sample size: with very small \(n_i\) per group, the test has low power. With very large samples, trivial differences in variance may become statistically significant.
- Outliers: outliers can inflate variance and distort tests; the median-based variant mitigates this but does not eliminate it.
- Multiple testing: if you run Levene’s test repeatedly across many outcomes or subsets, consider multiplicity adjustments.
- Complementary plots: always inspect standard deviations, boxplots, and residual plots alongside the numerical test.