ADescribe · Guide test 094
Brown–Forsythe variance test
Uses deviations from group medians in a robust modification of Levene’s test.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Equal spread tests — Do two or more groups have the same spread?
In Equal spread tests, choose Test = Brown–Forsythe (median-centered Levene).
Do it in CodeSplash Run this test on your own data, in Python or R.
Bench
Change the design, drag the data, move α. The statistic, its reference distribution and the verdict follow.
Bench · Brown–Forsythe variance test
Group i has true mean (i − 1) × spread.
Your data
Drag a point or use ↑/↓ to change itIf H₀ were true
- The reference: how W varies across samples when H₀ is true.
- Your statistic, from the data above.
- The p-value: the area at least as extreme as yours (p = .332).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- group median
The verdict
F(2, 42) = 1.13, p = .332
p > α = .050: compatible with H₀
Levene's test centered on medians: the recommended default variance check because it keeps its error rate for skewed data.
- Statistic
- 1.133
- p-value
- 0.3319
Brown–Forsythe variance test on Group 1: n = 15; Group 2: n = 15; Group 3: n = 15: F(2, 42) = 1.13, p = .332. The p-value is above α = .050, so the data are compatible with H₀.
Question and hypotheses
H0: groups have equal dispersion as represented by mean absolute centered deviations.
Assumptions
Independent groups; finite absolute deviations. Comparable shapes support interpretation as equal scale/variance. Exact normal ANOVA theory does not generally apply to transformed deviations.
Formula
Parameters and notation
cj is the group median; k groups,N observations. This is ANOVA on absolute centered deviations.
Structure of the method
Replace each group’s mean by its median when forming absolute deviations, then use the same between-group versus within-group ANOVA ratio. This Brown–Forsythe variant changes the dispersion transformation while retaining an approximate F calibration; it is separate from similarly named unequal-variance tests of means.
Estimated and nuisance parameters
Estimate group medians, mean absolute deviations from those medians, and transformed residual variance. Medians reduce sensitivity of the center estimate, but the final statistic still averages deviations. There is no learned prediction architecture; these sample summaries define the computation.
Settings and design choices
Set median centering explicitly, document median conventions for even group sizes, and specify groups, exclusions, and alpha. Select this robustness choice based on the sampling problem rather than the more favorable p-value from mean and median versions on the same dataset.
Fitting and adaptation
Recompute medians inside every repeated fit or valid resampling replicate. If distributions differ in location under a scale null, unrestricted label permutation is not automatically justified; use a model-appropriate calibration. Adaptation is refitting and recalibration, not neural fine-tuning.
Sensitivity and robustness
Tiny groups, many identical values, zero deviations, and substantially different distribution shapes can distort interpretation or calibration. Median centering does not make all tests distribution-free. Pair the result with plots and effect estimates; robust center estimation alone does not resolve clustering or serial dependence.
How to use and calibrate
Use an approximate Fk−1,N−k reference or a justified resampling scheme.
Example application
Compare dispersion across treatment groups with greater resistance to outliers.
Interpretation and pitfalls
Watch out
Center choice matters. Brown–Forsythe here is the median-centered variance test, distinct from the means test in entry 15.
What changed in edition 2
- New sections: structure of the method, estimated and nuisance parameters, settings and design choices, fitting and adaptation, sensitivity and robustness.
Python and R
Variance/scale homogeneity, not a test of equal means. Center choice distinguishes Levene from its median-centered Brown–Forsythe version.
Validated — Executed successfully in the validation environment · needs numpy, scipy
import numpy as np
from scipy import stats
rng = np.random.default_rng(2026)
groups = [rng.normal(m,1,20) for m in (0,.4,.8)]
print(stats.levene(*groups,center="median"))
Output
LeveneResult(statistic=np.float64(3.05103793809332), pvalue=np.float64(0.05510480387376032))
Validated — Executed successfully in the validation environment · needs car
set.seed(2026)
d <- data.frame(value=c(rnorm(20),rnorm(20,.4),rnorm(20,.8)), group=factor(rep(c("A","B","C"),each=20)))
print(car::leveneTest(value~group,d,center=median))
Output
Levene's Test for Homogeneity of Variance (center = median)
Df F value Pr(>F)
group 2 0.0061 0.9939
57Sources
- DescTools — DescTools · LeveneTestAuthor documentation/source reviewed: DescTools 0.99.60.search.r-project.org
- LeveneTestsearch.r-project.org
- leveneTestsearch.r-project.org
- Statistics guide v4 (historical):
- R: Executed successfully in the validation environment
- Reference's record:
- Edition 2 review: Python: executed · R: not executed (Rscript unavailable). Python: Ran in the reference's review, on this exact code. R: Reviewed but not run: R wasn't available to the reference's authors.
From the CodeSplash statistics guide (v4), entry 094, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT094.