BCompare groups · Guide test 015
Brown–Forsythe mean comparison test
Tests equality of several means under unequal variances; distinct from the Brown–Forsythe test of variance equality.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- One-way ANOVA (Welch / classic) — Do the means of three or more independent groups differ?
In One-way ANOVA (Welch / classic), choose Test = Brown–Forsythe F*.
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 mean comparison 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 F* 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 = .488).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- group variances, not pooled
- Satterthwaite denominator degrees of freedom
The verdict
F(2, 20.36) = 0.74, p = .488
p > α = .050: compatible with H₀
Same numerator as the classical F, but the denominator respects each group's own variance. Not the Brown–Forsythe test of variances.
- Statistic
- 0.744
- p-value
- 0.4878
Brown–Forsythe mean comparison test on Group 1: n = 10; Group 2: n = 10; Group 3: n = 10: F(2, 20.36) = 0.74, p = .488. The p-value is above α = .050, so the data are compatible with H₀.
Question and hypotheses
H0: μ1=⋯=μk despite possibly unequal variances; H1: some differ.
Assumptions
Independent groups with estimable variances; normality supports the reference approximation. This entry concerns the Brown–Forsythe mean comparison, not the median centered Levene variance test.
Formula
Parameters and notation
N is total sample size; x̄ is the ordinary grand mean. The classical approximation uses numerator degrees of freedom k−1 and denominator ν2; modified implementations may further adjust degrees of freedom.
Structure of the method
The mean-comparison Brown–Forsythe statistic divides sample-size-weighted between-group variation by a heteroskedastic variance combination. Its reference requires an approximate denominator degree of freedom; modified versions also adjust the numerator. This computation is unrelated to median-centered absolute deviations used in the Brown–Forsythe variance test.
Estimated and nuisance parameters
Estimate group means and separate variances, while the ordinary sample-size-weighted grand mean centers the between-group numerator. Sample sizes determine variance-combination weights. Returned numerator and denominator degrees of freedom are derived estimates, so recording only the F statistic omits material information needed to reproduce a p-value.
Settings and design choices
Choose the original Brown–Forsythe or Mehrotra-corrected reference explicitly, together with alpha and any follow-up family. The variance-handling option in software determines this choice. The correction is not a learned parameter, and comparing packages requires matching the exact reference rather than matching the shared method name.
Fitting and adaptation
Refit summaries after changes in grouping or observations and repeat the same correction convention. For resampling, generate under the equal-means null while preserving an appropriate group variance structure. Adaptation to repeated or clustered data requires a new covariance-aware model; this one-factor independent-groups statistic does not provide it.
Sensitivity and robustness
Small samples, strongly skewed populations, unstable group variances, and unbalanced designs can affect approximation quality. Statsmodels' primary pvalue under use_var='bf' uses Mehrotra-corrected degrees of freedom; its documented alternative fields provide the original Brown–Forsythe calculation. Cross-language numerical disagreement may therefore reflect a named-version difference rather than a bug.
How to use and calibrate
Form the ratio of between group variability to its heteroskedastic expectation and use the specified F approximation. Match the degrees of freedom to the chosen implementation.
Example application
Use as an omnibus unequal variance mean comparison in a one factor independent groups design.
Interpretation and pitfalls
Watch out
Do not substitute the Brown–Forsythe variance statistic. There are corrected versions of the mean test, so report which one and its returned degrees of freedom.
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.
- Rewritten in the review: interpretation and pitfalls.
Interpretation and pitfallsstatsmodels.org
The generic formula and primary Python output use different documented reference variants.
Corrected text
Do not substitute the Brown–Forsythe variance statistic. There are corrected versions of the mean test, so report which one and its returned degrees of freedom. The Python anova_oneway(use_var='bf') primary p-value uses Mehrotra-corrected degrees of freedom; the documented alternative fields expose the original Brown–Forsythe reference. State which version is reported before comparing Python and R results.
Python and R
Omnibus comparison: a small p-value does not identify which groups differ. Brown–Forsythe implementations can report both original and corrected degrees of freedom.
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(__import__("statsmodels.stats.oneway",fromlist=["anova_oneway"]).anova_oneway(groups,use_var="bf"))
Output
AnovaResult(statistic=np.float64(11.955319461826033), pvalue=np.float64(8.30096455817174e-05), df=(np.float64(1.864232171212151), np.float64(49.75317650486427)), df_num=np.float64(1.864232171212151), df_denom=np.float64(49.75317650486427), nobs_total=np.float64(60.0), n_groups=3, means=array([-0.09684371, 0.61021021, 1.38121647]), nobs=array([20., 20., 20.]), vars_=array([0.54821158, 0.81067911, 1.38385309]), use_var='bf', welch_correction=True, df2=(2, np.float64(49.75317650486427)), df_num2=2, pvalue2=np.float64(5.757031256000355e-05))
Validated — Executed successfully in the validation environment · needs onewaytests
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(onewaytests::bf.test(value~group,d))
Output
Brown-Forsythe Test
data: value and group
F = 8.6742, num df = 2.000, denom df = 56.076, p-value = 0.0005221
$statistic
[1] 8.674166
$parameter
[1] 2.00000 56.07576
$p.value
[1] 0.0005221438
$alpha
[1] 0.05
$method
[1] "Brown-Forsythe Test"
$data
value group
1 0.52058907 A
2 -1.07969076 A
3 0.13923812 A
4 -0.08474878 A
5 -0.66663962 A
6 -2.51608903 A
7 -0.73514680 A
8 -1.02012226 A
9 0.11355444 A
10 -0.47379098 A
11 -0.40821470 A
12 -0.73043328 A
13 -0.22143660 A
14 -0.22581652 A
15 -2.54688145 A
16 1.34700150 A
17 0.61640815 A
18 0.21756434 A
19 -0.80471883 A
20 0.68974678 A
21 0.07132799 B
22 0.23531842 B
23 -0.99202888 B
24 1.86582476 B
25 0.44820681 B
26 2.30808383 B
27 2.13094453 B
28 0.45814584 B
29 1.04532816 B
30 2.12562899 B
31 -0.12896692 B
32 0.56639203 B
33 0.14527643 B
34 0.73278236 B
35 0.58243281 B
36 1.56459375 B
37 0.99349285 B
38 -0.49177973 B
39 0.97725331 B
40 -0.42490558 B
41 -0.35725386 C
42 1.57799877 C
43 -0.40422179 C
44 1.10671410 C
45 -0.03365854 C
46 2.21814116 C
47 1.51178612 C
48 0.39750228 C
49 1.59936222 C
50 1.22648444 C
51 -0.36989867 C
52 0.59379984 C
53 -0.13061031 C
54 1.24939757 C
55 0.15519355 C
56 0.56857731 C
57 -0.43636801 C
58 -0.16095530 C
59 0.93395628 C
60 -0.19905272 C
$formula
value ~ group
attr(,"class")
[1] "owt"Sources
- Brown–Forsythe mean comparisonsearch.r-project.org
- bf.testsearch.r-project.org
- Statistics guide v4 (historical):
- Python: Executed successfully in the validation environment · R: Executed successfully in the validation environment
- Reference's record:
- Edition 2 review: Python: skip · R: not executed (Rscript unavailable); why not run: Python: Unavailable local dependencies: statsmodels. Python: Not run in the reference's review: Unavailable local dependencies: statsmodels. No installation attempted. R: Reviewed but not run: R wasn't available to the reference's authors.
From the CodeSplash statistics guide (v4), entry 015, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT015.