Contrasts, ANOVA, and nested models
Compare nested mean spaces using extra sums of squares and interpret group contrasts without treating significance as an effect size.
On this page
The question for today
What you’ll understand
- Express a group comparison as an estimable contrast.
- Derive the extra-sum-of-squares F statistic for nested designs.
- Distinguish joint tests, effect sizes, and multiplicity.
Analysis of variance and regression are two descriptions of the same projection geometry. A group model permits a separate mean for each group; a restricted model may require some or all means to coincide. Comparing those nested spaces asks whether the extra directions explain more response variation than the fitted noise scale would reasonably allow. Contrasts specify the scientific comparisons, while an F test can assess several restrictions together. Neither replaces reporting the size and uncertainty of the effects being compared.
A contrast names a scientific comparison
For group means collected in a vector μ, a contrast is a linear combination whose coefficients sum to zero. The difference between two group means is the simplest example. The zero-sum condition makes the comparison unchanged if every group mean shifts by the same amount. More general regression hypotheses use , where the rows of C specify coefficient combinations and d contains their hypothesized values. In a redundant parameterization those combinations must be estimable before an ordinary test has a meaningful target.
The model's parameterization affects coefficient labels but not the fitted group means or valid contrasts. An intercept-plus-indicators coding and a direct group-means coding can describe the same column space. For independent errors with common variance, the variance of a difference of two sample means is σ² times the sum of their reciprocal group sizes. Unequal sample sizes therefore affect precision even though the scientific meaning of the mean difference is unchanged.
Extra sums of squares measure an added subspace
Let the reduced design's column space be contained in the full design's column space. Denote their ranks by r and p, with q=p−r positive and n>p. The full residual sum of squares cannot exceed the reduced one, because the full fit can always choose the reduced fit. Their difference is the squared length of the response projected onto the q added orthogonal directions. It is not generally the same as fitting each predictor alone and adding its separate contribution.
Under the null that the true mean belongs to the reduced space, spherical Gaussian errors make that extra sum of squares divided by σ² chi-squared with q degrees of freedom. It is independent of the full-model residual sum of squares, which has n−p degrees of freedom. Dividing the two sums by their respective dimensions removes σ² and gives an exact F statistic. The full model supplies the denominator noise estimate; using the reduced residual there would mix the tested departure into the scale estimate.
Interpret the comparison at the scale of the question
For one estimable restriction, the corresponding two-sided t statistic squared equals the nested-model F statistic. With several restrictions, the joint F test asks whether at least one tested component departs from the null; it does not identify which component or how large a practically relevant effect is. A small p value can accompany a tiny effect in a very precise experiment, while a wide interval can leave an important effect unresolved in a small experiment.
In unbalanced or nonorthogonal designs, sequential sums of squares can depend on the order in which terms enter. State the actual reduced and full spaces rather than relying on a table label. Testing many response-chosen contrasts introduces multiplicity and selection issues, and observational group differences do not by themselves establish a causal effect. Random assignment, a prespecified comparison, and a model for dependence address different parts of the argument; none follows merely from the ANOVA decomposition.
Work it through
Two means versus one common mean
Group A has responses and group B has . Compare a common-mean model with a two-group-means model under independent equal-variance Gaussian errors.
The group means are 2 and 5. The full model has rank 2, and its residual sum of squares is . Its residual degrees of freedom are .
The pooled mean is 3.5. The between-group contribution is , so the reduced SSE is .
There is one added mean direction. Thus , with null reference . The estimated difference B−A is 3 with standard error .
The squared t statistic for the mean difference is , matching the F statistic. The numerical effect is 3 response units; the reference distribution and its assumptions are separate from that effect size.
The living notebook
Explore the model
Interactive lab · vectors
Resolve variation into perpendicular pieces
Pause and Reset; set Angle to 45 degrees and Magnitude to 2. Predict equal squared component lengths of 2, then inspect the readouts. Repeat from Reset with Angle=0 and Magnitude=2 to put all squared length in one direction. This two-axis geometry illustrates orthogonal sums of squares; it does not compute ANOVA p values, group means, or residual degrees of freedom.
- x component
- 1.393
- y component
- 0.975
- Magnitude
- 1.7
Playback traces a fixed vector and its projections. Angle and magnitude set the geometry; the moving marker does not change them. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA nested-model comparison isolates response length in added mean directions and compares it with a separately estimated noise scale.
Pause & reason
Check your understanding
Your turn
Try it yourself
A fixed full model of rank 4 has SSE=24 from n=12 observations. A nested rank-2 model has SSE=42. Calculate the F statistic and its null reference degrees of freedom. What does rejecting the reduced model establish?
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
First compute the added rank and the full residual degrees of freedom, then divide each sum of squares by its own dimension.
Compare with the solution
There are added directions and full-model residual degrees of freedom. The statistic is , with reference under spherical Gaussian errors and the reduced null. Rejection would indicate that the restrictions collectively conflict with that model; it would not identify a causal mechanism or establish that every added coefficient is nonzero.
Keep the idea
Take it with you
- Contrasts specify comparisons that survive a common mean shift.
- Nested F tests compare added rank with full-model residual rank.
- Joint significance, practical size, and causal interpretation answer different questions.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.