Skip to content
K Knidox Search…
Statistics · Inference

Levene’s Test

Test whether several groups have equal spread, with the median, mean or trimmed centre.

One group per line. Separate values with commas or spaces. Groups may differ in size.
Centre each group on

Centring on the median is the Brown–Forsythe variant. It is the robust default: skew and outliers move a median far less than a mean, so the test keeps its stated error rate on data that is not normal.

W
1.1192No difference found

F distribution with df 2, 27

p-value
0.3412

α = 0.05

Largest ÷ smallest variance
3.22

Under 4 is the usual rule of thumb

There is no evidence the spreads differ. That is not proof they are equal — a small sample can miss a real difference — but the equal-variance assumption is not contradicted here.

GroupnMeanSDCentre usedMean |deviation|
A105.0320.58315.1550.442
B104.6610.79374.550.597
C105.5260.44265.4350.334

The test is a one-way ANOVA on that last column: if the spreads were equal, the mean absolute deviations would be too.

Levene’s test checks whether several groups have the same spread — the assumption an ANOVA or pooled t-test rests on. It replaces every value by its distance from its group’s centre, then runs an ANOVA on those distances. A p above 0.05 leaves the equal-variance assumption intact.

A clever reduction

The idea is simpler than it first looks. If two groups have the same spread, their values sit about equally far from their own centres on average. So replace each value by that distance — |xᵢⱼ − centreᵢ| — and the question “do the spreads differ?” becomes “do the mean distances differ?”, which is exactly what a one-way ANOVA answers. Levene’s W is that ANOVA’s F statistic, read against the same F distribution with k − 1 and N − k degrees of freedom.

That reduction is why the test is so widely available and so easy to justify: nothing new is being assumed beyond what ANOVA already assumes about the transformed values, and the transformed values are far better behaved than the originals.

Why the median is the default here

Levene’s original used the mean. Brown and Forsythe showed in 1974 that centring on the median keeps the test’s actual error rate much closer to the nominal α when the data is skewed or heavy-tailed — precisely the situations where you are worried about assumptions in the first place. The size of that difference is easy to underestimate. Simulating three groups of twenty drawn from a lognormal distribution with genuinely equal variances, the mean-centred test declares the spreads unequal about 26% of the time; the median-centred one does so about 4%, which is roughly the 5% it promises. A mean is dragged toward a long tail and a median is not, so the median version is what R, SPSS and SciPy all default to, and what this page defaults to.

W = [(N − k) Σ nᵢ(z̄ᵢ − z̄)²] ÷ [(k − 1) Σ Σ (zᵢⱼ − z̄ᵢ)²]

where zᵢⱼ = |xᵢⱼ − centreᵢ|; compared against F with k − 1 and N − k degrees of freedom

  1. 1
    Find each group’s centre. The median by default; the mean gives Levene’s original version.
  2. 2
    Replace every value by its absolute deviation. A value of 6.11 in a group with median 5.155 becomes |6.11 − 5.155| = 0.955.
  3. 3
    Run a one-way ANOVA on those deviations. The between-group mean square over the within-group mean square gives W.
  4. 4
    Read W against the F distribution. For three groups of ten, W = 1.119 on 2 and 27 degrees of freedom gives p = 0.341.
  5. 5
    Interpret it as a green light, not a guarantee. p above α means nothing contradicts equal spreads. It is not evidence that they are equal.

Which centre to use

All three are ANOVAs on absolute deviations; only the centre changes.

CentreNameUse it when
MedianBrown–ForsytheThe default. Skewed data, outliers, or you are not sure — it holds its error rate best
MeanLevene’s originalThe groups are genuinely close to normal, where it has slightly more power
10% trimmed meanBrown–Forsythe, third formHeavy tails — more extreme values than a normal would produce

What to do when it comes out significant

A significant Levene result means the spreads differ by more than sampling explains, so a pooled analysis is not safe. The usual answer is not to abandon the comparison but to use a version that does not pool: Welch’s t-test for two groups and Welch’s ANOVA for more, both of which adjust the degrees of freedom instead of assuming a common variance. Both are now the recommended defaults in much of the methods literature regardless of what Levene says, precisely because they cost so little when the variances are equal.

Two cautions about reading the test. Like any test, its power depends on sample size: with small groups it will miss real differences in spread, and with very large ones it will flag differences too small to matter. The variance ratio shown alongside the p-value is a useful sanity check — a largest-to-smallest ratio under about 4 is generally tolerable for ANOVA even when the formal test objects.

The other caution is what the test is not. It says nothing about normality, which is a separate assumption checked with a Q–Q plot or the Shapiro–Wilk test. Levene is fairly robust to non-normality by design, which is the whole point of the median centring, but it is not a substitute for looking at the shape of your data.

What does Levene’s test actually test?
Whether several groups have equal population variances. The null hypothesis is that all the spreads are the same; a small p-value is evidence that at least one differs.
How does it work?
It replaces each value by its absolute distance from its group’s centre, then runs a one-way ANOVA on those distances. If the spreads are equal, the mean distances should be too.
Should I centre on the mean or the median?
The median, unless your data is clearly normal. Centring on the median is the Brown–Forsythe variant, and it keeps the error rate closer to α on skewed or heavy-tailed data — which is why R, SPSS and SciPy all default to it.
What is the difference between Levene and Brown–Forsythe?
Only the centre. Levene’s original used the group mean; Brown and Forsythe proposed the median and the trimmed mean as more robust choices. They are the same test otherwise.
What do I do if the test is significant?
Use a method that does not pool the variances — Welch’s t-test for two groups, Welch’s ANOVA for more. Both adjust the degrees of freedom rather than assuming a common variance.
Does a non-significant result prove the variances are equal?
No. It means nothing in the data contradicts that assumption. With small groups the test simply may not have the power to detect a real difference.
Is this the same as Bartlett’s test?
No. Bartlett’s test is more powerful when every group is genuinely normal, but it is badly sensitive to departures from normality. Levene’s — especially the median version — is the safer choice in practice.