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 glm; 
    class time temp;
    model y = time temp time*temp / ss1 ss2 ss3;
  run; 
  • How to fit the reduced model \(A|1,B, AB\)? Code like lm(y~b+a:b) or model y = b a*b does not fit the reduced model with no a main effect. Note \(\bar \mu_{1.} = \bar \mu_{2.} \Leftrightarrow \mu_{22} = \mu_{11} + \mu_{12} - \mu_{21}\). So we can replace \(\mu_{22}\) by three cell means.

  • Alternative Computation of Sums of Squares: Let \(SS = y'(P_{X_{reduced+term}} - P_{X_{reduced}})y\) represent any Type I, II or III sum of squares. Let \(q = rank(X_{reduced+term}) - rand(X_{reduced})\) be the degrees of freedom associated with \(SS\). Let \(C\) be any \(q\times p\) matrix whose rows are a basis for the row space of \((P_{X_{reduced+term}} - P_{X_{reduced}})X\). Then the ANOVA F statistic \[ \frac{SS/q}{MSE} = \frac{\hat\beta'C'[C(X'X)^-C']^{-1}C\hat\beta/q}{\hat\sigma^2} \] Thus, any \(SS\) can be computed as \(\hat\beta'C'[C(X'X)^-C']^{-1}C\hat\beta\) for an appropriate matrix \(C\).