Analysis of Variance & the F-Test

ANOVA turns a question about several group means into a comparison of two variance estimates: variation explained by group membership and variation left within groups. The F-ratio is meaningful only with the design, assumptions, and planned comparisons that make those estimates comparable.

Analysis of variance (ANOVA) asks whether a categorical grouping variable explains variation in a quantitative response. The name sounds indirect because the scientific question concerns means, but the evidence comes from variance: if group means really differ, observations should be more dispersed around the grand mean than they are around their own group means.

That comparison is the F-test. It is not a generic ritual for three or more groups, and a significant result does not say which means differ or whether the difference matters.

From a means question to two noise estimates #

For a one-factor design, observation YijY_{ij} is the $j$th replicate in group ii:

Yij=μ+αi+εij.Y_{ij}=\mu+\alpha_i+\varepsilon_{ij}.

μ\mu is the overall level, αi\alpha_i is the effect of group ii, and εij\varepsilon_{ij} is unexplained variation. Under the classical model, the errors are independent, have mean zero and common variance σ2\sigma^2, and are approximately normal when exact small-sample inference matters. The null hypothesis is

H0:α1=⋯=αg=0,H_0:\alpha_1=\cdots=\alpha_g=0,

equivalently, all gg group means are equal.

Let yˉi\bar y_i be group ii's mean, yˉ\bar y the grand mean, nin_i its sample size, and N=∑iniN=\sum_i n_i. Total squared variation partitions exactly:

∑i∑j(yij−yˉ)2⏟SST=∑ini(yˉi−yˉ)2⏟SSB+∑i∑j(yij−yˉi)2⏟SSE.\underbrace{\sum_i\sum_j(y_{ij}-\bar y)^2}_{SS_T} = \underbrace{\sum_i n_i(\bar y_i-\bar y)^2}_{SS_B} + \underbrace{\sum_i\sum_j(y_{ij}-\bar y_i)^2}_{SS_E}.

SSBSS_B is between-group variation; SSESS_E is residual, or within-group, variation. The cross-term vanishes because residuals within each group sum to zero. This algebra is the mechanism behind ANOVA, not merely a bookkeeping identity.

Each sum of squares grows with its number of independent directions, so compare mean squares:

MSB=SSBg−1,MSE=SSEN−g,F=MSBMSE.MS_B=\frac{SS_B}{g-1},\qquad MS_E=\frac{SS_E}{N-g},\qquad F=\frac{MS_B}{MS_E}.

Under H0H_0, both numerator and denominator estimate the same σ2\sigma^2, so their ratio should be near one apart from sampling variation. If group effects are present, MSBMS_B also contains their signal and tends to exceed MSEMS_E. Under the model, FF follows an Fg−1,N−gF_{g-1,N-g} distribution.

Worked example #

Suppose three process settings produce:

Setting Measurements Mean
A 7, 8, 9 8
B 10, 11, 12 11
C 13, 14, 15 14

The grand mean is 11. Therefore

SSB=3[(8−11)2+(11−11)2+(14−11)2]=54.SS_B=3[(8-11)^2+(11-11)^2+(14-11)^2]=54.

Each group has residuals −1,0,1-1,0,1, so SSE=3(1+0+1)=6SS_E=3(1+0+1)=6. With g=3g=3 and N=9N=9,

MSB=54/2=27,MSE=6/6=1,F=27.MS_B=54/2=27,\qquad MS_E=6/6=1,\qquad F=27.

The effect is large relative to within-setting scatter. But the omnibus test still answers only “not all means are equal.” A planned contrast such as C versus A, or a multiplicity-controlled post-hoc procedure, is needed to identify the relevant difference. Reporting mean differences and uncertainty is more informative than reporting the p-value alone.

ANOVA is a linear model #

ANOVA and regression are the same machinery with different encodings. A factor with gg levels becomes g−1g-1 indicator columns in a design matrix XX; least squares fits y=Xβ+εy=X\beta+\varepsilon. The F-test compares a reduced model, without selected factor terms, to a full model:

F=(SSER−SSEF)/(dfR−dfF)SSEF/dfF.F=\frac{(SSE_R-SSE_F)/(df_R-df_F)}{SSE_F/df_F}.

This view scales naturally to several factors, covariates, unequal group sizes, and interaction terms. In a two-factor model,

Y=μ+αi+βj+(αβ)ij+ε,Y=\mu+\alpha_i+\beta_j+(\alpha\beta)_{ij}+\varepsilon,

the interaction asks whether one factor's effect changes with the other. If interaction is material, a single “main effect” average can hide the mechanism—for example, a treatment that helps at low temperature but harms at high temperature.

Assumptions belong to the design #

  • Independence is usually the most important assumption. Ten readings from one device are not ten independent devices. Repeated measures, clusters, batches, or time order require blocking, mixed models, or an explicit dependence model.
  • Equal variance means comparable residual spread across groups. Severe imbalance plus unequal variances can badly distort the classical F-test. Welch's ANOVA is a useful unequal-variance alternative for a one-factor comparison.
  • Normality concerns residuals, not raw observations. The F-test is often reasonably robust to mild non-normality in balanced designs, but small samples, strong skew, and outliers demand residual diagnostics or a model suited to the response distribution.
  • The model must include the design. Omitting blocks, interactions, or covariates can inflate residual noise or confound an effect.

Plot residuals against fitted values, group, run order, and important covariates. A normal quantile plot can expose heavy tails, but no diagnostic plot repairs pseudoreplication.

What the F-test does not establish #

A tiny p-value is not an effect size, a causal claim, or evidence that every group differs. With very large NN, practically negligible differences can be statistically clear. Conversely, failure to reject does not establish equality; it may reflect poor precision. Equivalence requires margins and an equivalence design.

A common counterexample is an experiment with identical group means but different variances. Classical mean ANOVA may not reject the mean null, although the groups plainly have different distributions. If the scientific question concerns spread, tails, or failure probability, use a method that targets that property.

Practical reasoning sequence #

  1. Identify the experimental unit and the source of independent replication.
  2. Write the model implied by randomization, blocking, and repeated measurement.
  3. Visualize group distributions and residuals, not only means.
  4. Test the scientifically relevant factor or contrast.
  5. Report estimates, intervals, effect size, and residual diagnostics alongside the F-test.

ANOVA is strongest when it reflects how data were generated. Applied mechanically to an arbitrary spreadsheet column, its clean decomposition can conceal a broken causal comparison.

Sources

  1. bookData Recognition and Classification: Lecture Notespdfnotes
  2. docsNIST/SEMATECH e-Handbook: One-Factor ANOVA
  3. docsNIST/SEMATECH e-Handbook: Multi-Factor ANOVA
  4. docsNIST/SEMATECH e-Handbook: Analysis of Variance Models

Searches titles, aliases, headings, summaries, and full text.↑↓ move ↵ open esc close