Chapter 8 ANOVA for Unbalanced Two-Factor Experiments
when data are unbalanced, the type 1 ANOVA test for two-way interactions is the same as the test for two-way interactions discussed previously. However, the type 1 ANOVA tests for individual factors are not the tests for main effects discussed previously. Furthermore, the type 1 results for individual factors depend on the order that the factors appear in the type 1 ANOVA table.
The test for main effects is based on LSMEANS (equal weighted), but Type 1 ANOVA test does not compute LSMEANS
Different types of Sums of Squares
Source Type I Type II Type III A SS(A|1) SS(A|1, B) SS(A|1, B, AB) B SS(B|1, A) SS(B|1, A) SS(B|1, A, AB) AB SS(AB|1, A, B) SS(AB|1, A, B) SS(AB|1, A, B) Error SSE SSE SSE C. Total SSTotal ? ? - For balanced data, Type I = Type II = Type III, The ANOVA F tests in the ANOVA table can be used to test for factor main effects and interaction
- For unbalanced data, Type I sums of squares always add to the total sum of squares, Type II and Type III sums of squares do not add to anything special when data are unbalanced. The ANOVA F tests in the Type III ANOVA table can be used to test for factor main effects and interaction.
SAS code
;
proc glmclass time temp;
= time temp time*temp / ss1 ss2 ss3;
model y ; run
How to fit the reduced model A|1,B,AB? Code like
lm(y~b+a:b)
ormodel y = b a*b
does not fit the reduced model with noa
main effect. Note ˉμ1.=ˉμ2.⇔μ22=μ11+μ12−μ21. So we can replace μ22 by three cell means.Alternative Computation of Sums of Squares: Let SS=y′(PXreduced+term−PXreduced)y represent any Type I, II or III sum of squares. Let q=rank(Xreduced+term)−rand(Xreduced) be the degrees of freedom associated with SS. Let C be any q×p matrix whose rows are a basis for the row space of (PXreduced+term−PXreduced)X. Then the ANOVA F statistic SS/qMSE=ˆβ′C′[C(X′X)−C′]−1Cˆβ/qˆσ2 Thus, any SS can be computed as ˆβ′C′[C(X′X)−C′]−1Cˆβ for an appropriate matrix C.