Degrees of freedom

All model terms have degrees of freedom that are equal to the number of non-zero unknown parameters. (All main effect and interaction parameters that involve the base level for any factor are defined to be zero.) The table below shows the degrees of freedom corresponding to the main effects and interactions in a hierarchical model for factors B (b levels), C (c levels) and D (d levels).

  Model term     Number of parameters (d.f.)  
(mean) 1
B main effect b - 1
C main effect c - 1
D main effect d - 1
B*C interaction (b - 1)(c - 1)
B*D interaction (b - 1)(d - 1)
C*D interaction (c - 1)(d - 1)
B*C*D interaction (b - 1)(c - 1)(d - 1)

The full hierarchical model with a 3-factor interaction has all the above terms and therefore has the sum of these degrees of freedom, bcd. (This model allows all bcd combinations of factor levels to have separately adjustable mean responses.)

Residual and explained sums of squares

Each additional main effect or interaction term that is added to a model gives it extra flexibility, allowing the residual sum of squares to be reduced. These reductions are the sums of squares that are explained by the terms and can be presented in a sum of squares table with their degrees of freedom.

In a factorial experiment with equal replicates for all factor combinations, the factors and their interactions are orthogonal (uncorrelated) so the order of adding terms in the sum of squares table does not affect their sums of squares.

Soft drink bottling

The diagram above initially shows a model for the soft drink bottling data with no explanatory factors. None of the variation is explained by this model so the residual sum of squares equals the total sum of squares.

Click the checkboxes to the left of the model terms to add them to the model. Observe that each additional term gives the model extra flexibility that allows the residual sum of squares to be reduced — the reduction is the explained sum of squares for this term.

Check that the degrees of freedom for each term matches the formula at the top of this page.