# Two-way Analysis of Variance

Page Contents

## Two Criteria

In One-way ANOVA the observations were split into groups depending on some criteria. We will now look at a slightly more complicated model, with two criteria.

We have ~n observations split by the first criterion into ~r groups A_1,...,A_{~r}, and by the second criterion into ~s groups B_1,...,B_{~s}.
Furthermore suppose that there are exactly ~t observations in each intersect A_~iB_~j, so that ~n = ~{rst}. This is called a ~{balanced} model.

The following hypotheses (or sub-models) can be identified immediately:

• &mu. &in. L_I = \{&mu._{~i~j~k} = &phi._{~i~j~k} ; ~i=1, ... ~r ; ~j=1, ... ~s ; ~k=1, ... ~t \} [ = &reals.^~n ]
- this is just the general model for ~n observations.
• &mu. &in. L_{AB} = \{&mu._{~i~j~k} = &gamma.~{_{ij}} ; ~i=1, ... ~r ; ~j=1, ... ~s \}
- all observations in the same cell ( e.g. A_~i B_~j) have the same mean.
• &mu. &in. L_{A} = \{&mu._{~i~j~k} = &alpha._~i ; ~i=1, ... ~r \}
- all observations in the same A-group have the same mean (no variation across B-groups).
• &mu. &in. L_{B} = \{&mu._{~i~j~k} = &beta._~j ; ~j=1, ... ~s \}
- all observations in the same B-group have the same mean (no variation across A-groups).
• &mu. &in. L_0 = \{&mu._{~i~j~k} = &kappa. ; \}
- all observations have the same mean.

Note that _ L_0 &subset. L_A &subset. L_{AB} &subset. L_I = &reals.^~n _ and _ L_0 &subset. L_B &subset. L_{AB} &subset. L_I = &reals.^~n.
In fact we could consider each of the models, L_A, L_B, and L_{AB} in turn using the methods used in One-way ANOVA . The projections p_A, p_B, and p_{AB} as well as p_0 and p_I are all known, as well as the sums of squares and degrees of freedom.

There is one more hypothesis (or sub-model) we want to consider:

• &mu. &in. L_{A+B} = \{&mu._{~i~j~k} = &alpha._~i + &beta._{~j~i} ; ~i=1, ... ~r ; ~j=1, ... ~s \}
- observations in the same intersect have the same mean, but the variation accross the A and B groups is additive.

We have that _ L_A &subset. L_{A+B} &subset. L_{AB} _ and _ L_A &subset. L_{A+B} &subset. L_{AB}, but as yet we don't know the projection p_{A+B} onto L_{A+B}.

Consider the two linear spaces Q_A and Q_B defined by _ _ _ _ _ L_A = Q_A &oplus. L_0 _ _ _ _ _ L_B = Q_B &oplus. L_0
i.e. Q_A = \{#~x &in. &reals.^~n | ~{x_{ijk}} = &alpha._~i where &sum. &alpha._~i = 0 \} _ and _ Q_B = \{#~x &in. &reals.^~n | ~{x_{ijk}} = &beta._~j where &sum. &beta._~j = 0 \}

If _ #~v &in. Q_A _ and _ #~u &in. Q_B _ then _ #~v = ( ~v_{~i~j~k} ) , _ ~v_{~i~j~k} = &alpha._~i, _ &sum._~i &alpha._~i = 0 _ and _ #~u = ( ~u_{~i~j~k} ) , _ ~u_{~i~j~k} = &beta._~j, _ &sum._~j &beta._~j = 0
Then _ #{~u.}#~v _ = _ ~t &sum._~i&sum._~j &alpha._~i &beta._~j _ [Note: this is #{only} because the model is balanced], _ = _ ~t &sum._~i (&alpha._~i (&sum._~j &beta._~j)) _ = _ 0, _ so Q_A &perp. Q_B.

Now L_{A+B} _ = _ L_A + L_B _ [not necessarily orthogonal] = _ (Q_A &oplus. L_0) + (Q_B &oplus. L_0) _ = _ Q_A &oplus. Q_B &oplus. L_0.
So we have an orthogonal split of L_{A+B}, and _ p_{A+B} = (p_A - p_0) + (p_B + p_0) - p_0 _ = _ p_A + p_B &minus. p_0 .