Levene's Test Calculator
Levene's test examines whether the population variances of two or more groups are equal. Every observation is converted into its absolute distance from the center of its own group, and a one-way ANOVA is run on those distances: when the spread differs between groups, so do the mean absolute deviations, and the W statistic grows.
The independent samples t-test and one-way ANOVA pool the variances, assuming the groups share a common one. When that assumption breaks and the group sizes are unbalanced as well, the Type I error rate climbs far above the nominal level. This calculator uses the median-centered Brown-Forsythe version by default, computes the mean-centered classic Levene result alongside it, tabulates each group variance together with its confidence interval, and visualizes the spread with a box plot.
Levene / Brown-Forsythe Test Statistic
zᵢⱼ = | xᵢⱼ − centerᵢ | center = median (Brown-Forsythe) or mean (Levene)
z̄ᵢ = Σⱼ zᵢⱼ / nᵢ — within-group mean absolute deviation
z̄ = ΣΣ zᵢⱼ / N — overall mean absolute deviation
W = [ (N − k) / (k − 1) ] · Σ nᵢ (z̄ᵢ − z̄)² / ΣΣ (zᵢⱼ − z̄ᵢ)²
df₁ = k − 1, df₂ = N − k, W ~ F(df₁, df₂)
Group variance: sᵢ² = Σ(xᵢⱼ − x̄ᵢ)² / (nᵢ − 1)
Variance CI: [ (n−1)s² / χ²_{1−α/2} , (n−1)s² / χ²_{α/2} ]
H₀: σ₁² = σ₂² = … = σₖ² · H₁: at least one variance differsThe median-centered version was proposed by Brown and Forsythe (1974) and is robust to departures from normality; it is the "Based on Median" row in the SPSS Explore and One-Way ANOVA output, and the default of car::leveneTest(center = median) in R. The mean-centered version should be preferred only when the groups are approximately normal.
How to Calculate
- Write all the values of one group on each line; if you like, start a line with a label in the form "Group name: values".
- Choose the measure of center — if you are not confident about normality, stay with the default median (Brown-Forsythe) option.
- Set the significance level; α = 0.05 is standard for an assumption check.
- Read W, df₁, df₂, and the p-value: if p < α, the variances are NOT homogeneous, meaning the assumption has been violated.
- In the group variance table, look at which group breaks the pattern of spread and whether the variance confidence intervals overlap.
- Compare the box heights in the box plot; if the assumption is violated, switch to a Welch-corrected t-test or Welch ANOVA.
Worked Examples
Three teaching methods — different variances (n = 10 x3)
The Brown-Forsythe test gives W(2; 27) = 8.170 with p = 0.002; since the critical F is 3.3541, W lies above that bound and homogeneity of variance is rejected. The group variances are 3.73, 23.60, and 6.68, so the largest-to-smallest ratio is 6.32. The mean absolute deviation of the blended-method group is 4.20 against 1.60 and 2.10 for the others — Welch ANOVA should be used in place of a classic ANOVA.
Levene W statistic: 8.1701 · df₁ (between groups): 2 · df₂ (within groups): 27
Three groups with homogeneous variances (n = 12 x3)
Although the means are very different, the spreads are almost identical: the variances are 2.09, 1.90, and 1.90, and the ratio is only 1.10. With Brown-Forsythe W(2; 33) = 0.0447 and p = 0.956, the homogeneity of variance assumption holds comfortably. This is the textbook situation in which a classic one-way ANOVA can be applied with confidence.
Levene W statistic: 0.0447 · df₁ (between groups): 2 · df₂ (within groups): 33
How an outlier affects the choice of center (2 groups)
A single value of 31 in the control group raises its variance to 11.39 (against 2.22 in the treatment group). The mean-centered classic Levene gives W(1; 18) = 0.6125 with p = 0.444; on the same data the median-centered Brown-Forsythe gives W = 0.0847 with p = 0.774. The choice of center changes W more than sevenfold — a direct illustration of why the median-centered version is the default when outliers are present.
Levene W statistic: 0.6125 · df₁ (between groups): 1 · df₂ (within groups): 18