 7. Product and Process Comparisons
7.4. Comparisons based on data from more than two processes
7.4.3. Are the means equal?

## Models and calculations for the two-way ANOVA

Basic Layout
The balanced two-way factorial layout Factor $$A$$ has 1, 2, ..., $$a$$ levels. Factor $$B$$ has 1, 2, ..., $$b$$ levels. There are $$ab$$ treatment combinations (or cells) in a complete factorial layout. Assume that each treatment cell has $$r$$ independent obsevations (known as replications). When each cell has the same number of replications, the design is a balanced factorial. In this case, the $$abr$$ data points $$\{y_{ijk}\}$$ can be shown pictorially as follows: $$\begin{array}{cccc} & & \mbox{Factor } B \\ \mbox{Factor } A & 1 & 2 & \ldots & b \\ 1 & y_{111}, \, y_{112}, \, \ldots, \, y_{11r} & y_{121}, \, y_{122}, \, \ldots, \, y_{12r} & \ldots & y_{1b1}, \, y_{1b2}, \, \ldots, \, y_{1br} \\ 2 & y_{211}, \, y_{212}, \, \ldots, \, y_{21r} & y_{221}, \, y_{222}, \, \ldots, \, y_{22r} & \ldots & y_{2b1}, \, y_{2b2}, \, \ldots, \, y_{2br} \\ \vdots & \vdots & \vdots & \ldots & \vdots \\ a & y_{a11}, \, y_{a12}, \, \ldots, \, y_{a1r} & y_{a21}, \, y_{a22}, \, \ldots, \, y_{a2r} & \ldots & y_{ab1}, \, y_{ab2}, \, \ldots, \, y_{abr} \\ \end{array}$$
How to obtain sums of squares for the balanced factorial layout Next, we will calculate the sums of squares needed for the ANOVA table.
• Let $$A_i$$ be the sum of all observations of level $$i$$ of factor $$A$$, $$i = 1, \, \ldots, \, a$$. The $$A_i$$ are the row sums.

• Let $$B_j$$ be the sum of all observations of level $$j$$ of factor $$B$$, $$j = 1, \, \ldots, b$$. The $$B_j$$ are the column sums.

• Let $$(AB)_{ij}$$ be the sum of all observations of level $$i$$ of $$A$$ and level $$j$$ of $$B$$. These are cell sums.

• Let $$r$$ be the number of replicates in the experiment; that is: the number of times each factorial treatment combination appears in the experiment.
Then the total number of observations for each level of factor $$A$$ is $$rb$$ and the total number of observations for each level of factor B is $$ra$$ and the total number of observations for each interaction is $$r$$.

Finally, the total number of observations $$n$$ in the experiment is $$abr$$.

With the help of these expressions, we obtain (omitting derivations): $$\begin{eqnarray} \mbox{CM } & = & \frac{(\mbox{Sum of all observations})^2}{rab} \\ & & \\ SS_{total} & = & \sum (\mbox{each observation})^2 - CM \\ & & \\ SS(A) & = & \frac{\sum_{i=1}^a A_i^2}{rb} - CM \\ & & \\ SS(B) & = & \frac{\sum_{j=1}^b B_j^2}{ra} - CM \\ & & \\ SS(AB) & = & \frac{\sum_{i=1}^a \sum_{j=1}^b (AB)_{ij}^2}{r} - CM - SS(A) - SS(B) \\ & & \\ SSE & = & SS_{total} - SS(A) - SS(B) - SS(AB) \end{eqnarray}$$

These expressions are used to calculate the ANOVA table entries for the (fixed effects) two-way ANOVA.

Two-Way ANOVA Example:
Data An evaluation of a new coating applied to 3 different materials was conducted at 2 different laboratories. Each laboratory tested 3 samples from each of the treated materials. The results are given in the next table:

 Materials ($$B$$) LABS ($$A$$) 1 2 3 4.1 3.1 3.5 1 3.9 2.8 3.2 4.3 3.3 3.6 2.7 1.9 2.7 2 3.1 2.2 2.3 2.6 2.3 2.5
Row and column sums The preliminary part of the analysis yields a table of row and column sums.

 Material ($$B$$) Lab ($$A$$) 1 2 3 Total ($$A_i$$) 1 12.3 9.2 10.3 31.8 2 8.4 6.4 7.5 22.3 Total ($$B_j$$) 20.7 15.6 17.8 54.1
ANOVA table From this table we generate the ANOVA table.

 Source SS df MS F p-value A 5.0139 1 5.0139 100.28 0 B 2.1811 2 1.0906 21.81 .0001 AB 0.1344 2 0.0672 1.34 .298 Error 0.6000 12 0.0500 Total (Corr) 7.9294 17 