Skip to content

BCompare groups · Guide test 020

Welch type trimmed mean ANOVA

Compares several trimmed means, accommodating unequal variances; implemented in robust methods such as WRS2.

Runs in CodeSplashPython example validatedR example validated

Do it in CodeSplash

In the app, set it up in Analyze with this method:

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

3
10
0.60

Group i has true mean (i − 1) × spread.

2.50
0.050

Your data

Drag a point or use ↑/↓ to change it
Group 1 · n = 10 · mean 0.16Group 2 · n = 10 · mean 1.07Group 3 · n = 10 · mean 0.62

If H₀ were true

F = 1.42
  1. The reference: how F varies across samples when H₀ is true.
  2. Your statistic, from the data above.
  3. The p-value: the area at least as extreme as yours (p = .292).
  4. The hatched rejection region at α = .050: statistics landing here reject H₀.

The formula

Ft=1k−1∑jwj(xˉtj−x~)21+2(k−2)k2−1∑j(1−wj/U)2hj−1F_t = \dfrac{\frac{1}{k-1}\sum_j w_j(\bar x_{tj}-\tilde x)^2}{1+\frac{2(k-2)}{k^2-1}\sum_j\frac{(1-w_j/U)^2}{h_j-1}}

With your numbers

Ft=1.42,ν2=9.01F_t = 1.42,\quad \nu_2 = 9.01
xˉtj\bar x_{tj}
trimmed means
wjw_j
inverse squared standard errors from winsorized variances
x~\tilde x
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 H0.

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

wj=1/djxˉtw=∑jwjxˉtj∑jwjB=∑j(1−wj/W)2hj−1Ft=∑jwj(xˉtj−xˉtw)2/(k−1)1+2(k−2)B/(k2−1)\begin{gathered}w_j=1/d_j\\[5pt] \bar x_{tw}=\frac{\sum_jw_j\bar x_{tj}}{\sum_jw_j}\\[5pt] B=\sum_j\frac{(1-w_j/W)^2}{h_j-1}\\[5pt] F_t=\frac{\sum_jw_j(\bar x_{tj}-\bar x_{tw})^2/(k-1)}{1+2(k-2)B/(k^2-1)}\end{gathered}

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.

Python · native

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)
R

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

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.