To illustrate the issue, consider the following DATA and GLM steps. While PROC GLM is shown here, the same issue can be seen in other modeling procedures such as MIXED, GENMOD, LOGISTIC, and others.
data test;
input a b c d y;
datalines;
1 1 1 1 4.6968
1 1 1 2 4.3047
1 1 2 1 5.7818
1 1 2 2 5.0616
1 1 3 1 7.4115
1 1 3 2 5.2077
1 2 1 1 3.6001
1 2 1 2 6.2835
1 2 2 1 8.6439
1 2 2 2 7.7412
1 2 3 1 10.4886
1 2 3 2 9.2264
2 1 1 1 5.9419
2 1 1 2 5.7359
2 1 2 1 10.0184
2 1 2 2 9.0556
2 1 3 1 10.0239
2 1 3 2 11.9515
2 2 1 1 9.7912
2 2 1 2 11.7381
2 2 2 1 15.7579
2 2 2 2 16.6551
2 2 3 1 19.9313
2 2 3 2 20.5158
3 1 1 1 11.4356
3 1 1 2 10.5874
3 1 2 1 12.8707
3 1 2 2 15.4366
3 1 3 1 16.3203
3 1 3 2 17.0880
3 2 1 1 19.2008
3 2 1 2 18.1372
3 2 2 1 22.7538
3 2 2 2 23.5725
3 2 3 1 26.8162
3 2 3 2 29.3128
;
proc glm;
class a b c d;
model y = a a*b a*b*c d;
run;
quit;
The following are partial results from PROC GLM.
The degrees of freedom (DF) for each individual main effects should be: df_A=2, df_B=1, df_C=2, df_D=1. However, the output shows that the degrees of freedom for A*B is 3, not 2x1=2. Similarly, the degrees of freedom for A*B*C is 12, not 2x1x2=4.
This is because this model is not hierarchical. That is, some lower-order effects (B, C, A*C, B*C) are omitted from the model. In this situation, an omitted effect is automatically pooled with the lowest-order effect in the model that contains the omitted effect. As a result, the degrees of freedom of lower-order effects that are omitted from the model (and their contributions such as sums of squares in least-squares procedures like ANOVA and GLM) are automatically pooled with appropriate higher-order effects in the model. In this model for example, the degrees of freedom and sum of squares contribution for the omitted main effect, B, are pooled with A*B because it is the lowest-order effect containing B. Therefore, the degrees of freedom for A*B is df_A*B + df_B = 2+1 = 3. Similarly, the degrees of freedom and sum of squares contributions for omitted effects C, A*C, and B*C are pooled with A*B*C. Therefore, the degrees of freedom for A*B*C is df_A*B*C + df_C + df_A*C + df_B*C = 4+2+4+2 = 12.