BCompare groups · Guide test 020
Welch type trimmed mean ANOVA
Compares several trimmed means, accommodating unequal variances; implemented in robust methods such as WRS2.
Do it in CodeSplash
In the app, set it up in Analyze with this method:
- Trimmed-means ANOVA (Welch-type, robust) — Do three or more independent groups differ in their trimmed means when tails are heavy or spreads differ?
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 · Welch type trimmed mean ANOVA
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 = .292).
- The hatched rejection region at α = .050: statistics landing here reject H₀.
The formula
With your numbers
- trimmed means
- inverse squared standard errors from winsorized variances
- weighted grand trimmed mean
The verdict
F(2, 9.01) = 1.42, p = .292
p > α = .050: compatible with H₀
Welch's ANOVA on trimmed means (Wilcox's t1way): robust to outliers, heavy tails and unequal variances at once.
- Statistic
- 1.417
- p-value
- 0.2918
Welch type trimmed mean ANOVA on Group 1: n = 10; Group 2: n = 10; Group 3: n = 10: F(2, 9.01) = 1.42, p = .292. The p-value is above α = .050, so the data are compatible with H₀.
Question and hypotheses
H0: the k population γ trimmed means are equal; H1: at least one differs.
Assumptions
Independent groups, a prespecified trimming fraction, and enough retained data to estimate Winsorized variability. Unequal group variances are allowed; the target is robust location rather than the ordinary mean.
Formula
Parameters and notation
hj and dj are the retained size and estimated trimmed mean variance defined for Yuen’s test; W=Σwj. Reference denominator degrees of freedom are (k²−1)/(3B).
Structure of the method
Compute group trimmed means and Winsorized variances, then insert their estimated mean variances and retained sample sizes into a Welch-style omnibus construction. Precision weights and a finite-sample correction yield an F approximation. A documented bootstrap alternative must reproduce all trimming and variance operations, not merely resample already-trimmed vectors.
Estimated and nuisance parameters
Estimate robust group locations, Winsorized scales, precision weights, and the weighted null center. The retained counts are determined by the trim fraction and original group sizes. The hypothesized equality concerns population trimmed means; ordinary means can differ while that robust null holds, especially through tail changes.
Settings and design choices
Select trimming fraction, integer/fractional trimming convention, analytic or bootstrap reference, alpha, and robust follow-up contrasts. The bootstrap count determines simulation precision. Prespecify robustness choices from the measurement problem; trying several trim levels and reporting only the smallest p-value changes the error rate.
Fitting and adaptation
Refit trimmed means and Winsorized variability together whenever samples change. For several robust pairwise comparisons, use a matching simultaneous procedure instead of ordinary pooled-variance Tukey tests. Adaptation to clustered data requires resampling or modeling clusters explicitly; robust marginal location does not remove dependence.
Sensitivity and robustness
Tiny retained samples, ties at trimming cutoffs, and groups with effectively zero Winsorized variance can destabilize weighting and degrees of freedom. Heterogeneous distributions may make a common trim fraction represent different substantive portions of each population. Report retained sizes and tail summaries alongside the robust omnibus conclusion.
How to use and calibrate
Trim means and Winsorize variances within each group, substitute their variance estimates into the Welch type construction, and compare with the corresponding F distribution or a justified bootstrap.
Example application
Compare 20% trimmed outcomes across several independent groups with heavy tails and unequal spread.
Interpretation and pitfalls
Watch out
The estimand differs from ordinary ANOVA. Choose trimming in advance; applying ordinary ANOVA to manually trimmed samples gives the wrong variance calculation.
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
Omnibus test across independent groups; use the model assumptions in this entry and plan multiplicity-adjusted follow-up comparisons.
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="unequal",trim_frac=.2))
Output
AnovaResult(statistic=np.float64(7.931739451864644), pvalue=np.float64(0.00293483939458666), df=(2.0, np.float64(19.87671467080687)), df_num=2.0, df_denom=np.float64(19.87671467080687), nobs_total=np.int64(36), n_groups=3, means=array([-0.04678128, 0.61170635, 1.22046256]), nobs=array([12, 12, 12]), vars_=array([0.24079978, 0.65535526, 1.17103511]), use_var='unequal', welch_correction=True, df2=None, df_num2=None, pvalue2=None)
Validated — Executed successfully in the validation environment · needs WRS2
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(WRS2::t1way(value~group,d,tr=.2))
Output
Call: WRS2::t1way(formula = value ~ group, data = d, tr = 0.2) Test statistic: F = 7.2893 Degrees of freedom 1: 2 Degrees of freedom 2: 21.34 p-value: 0.00387 Explanatory measure of effect size: 0.55 Bootstrap CI: [0.38; 0.8]
Sources
- WRS2 — WRS2 · t1wayAuthor documentation/source reviewed: WRS2 1.1-7.search.r-project.org
- t1waysearch.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 020, updated from the reference's edition 2 (reviewed 14 November 2026) as STAT020.