# Formulae for interaction sums of squares (SS) in balanced designs

Formulae for interaction sums of squares in a factorial (between subject) analysis of variance can be expressed as a sum of squared residuals. The residual formulae may be found to be easier to use for computing purposes than those (for example in Howell, 2002 as they only involve the squaring of only one term.

Boniface (1995) gives the formula for the **two-way interaction** SS as

sum over combinations i,j n(ij) (mean(ij) - mean(i+) - mean(+j) + overall mean)$$^{2}$$

where n(ij) observations have combination of values i and j. These are assumed equal for all i and j (balance). The '+' in the subscripts denotes pooling so, for example, mean(i+) signifies the mean when the first factor takes the value i.

Using formulae in Howell (2002, p.459) for the three-way interaction and the orthogonality of the sums of squares in the anova for balanced designs we can define the **SS(three-way interaction)** as

sum over combinations i,j,k n(ijk) (mean(ijk) + mean(i++) + mean(+j+) + mean(++k) - mean(ij+) - mean(i+k) - mean(+jk) - overall mean)$$^{2}$$

where n(ijk) observations have combination of values i, j and k. These are assumed equal for all i, j and k (balance). The '+' in the subscripts denotes pooling so that, for example, mean(i++) signifies the mean when the first factor takes the value i and mean(ij+) signifies the mean when the first two factors have values i and j respectively.

For a **four-way interaction** the sums of squares are

sum over combinations i,j,k,l n(ijkl) (mean(ijkl) - mean(i+++) - mean(+j++) - mean(++k+) - mean(+++l) + mean(ij++) + mean(i+k+) + mean(i++l) + mean(+jk+) + mean(+j+l) + mean(++kl) - mean(ijk+) - mean(ij+l) - mean(i+kl) - mean(+jkl) + overall mean)$$^{2}$$.

The above four-way interaction is simply the sum over all combinations of the four factors. For each combination of four factors the cell mean for that combination has subtracted all of its one-way and three-way means with all its two-way means added as well as the overall mean.

These formulae are used in this spreadsheet to compute an analysis of variance for *balanced* designs of upto 2 between and 2 within subject factors. Note : The anova table is outputted in Sheet 2 of the spreadsheet.

It also follows from Boniface that SS(subjects x W) where W is the within subjects factor can be similarly obtained e.g. in his one way within subjects ANOVA example Boniface states that the SS(reliability)=SS(subjects x W)) for I rows (subjects) and J rows (conditions=within subjects factor) is as below:

SS(subjects x W) = Sum(i,j)(X(ij - (mean of X(i+)- overall mean) - (mean of X(+j)- overall mean) - overall mean)$$^{2}$$

= Sum(i,j)(X(ij) - mean of X(i+) - mean of X(+j) + overall mean)$$^{2}$$

which is in the form of the formulae for interactions discussed above which also

= Sum(i,j)(X(ij) - (mean of X(+j) - overall mean) - mean of X(i+) )$$^{2}$$

which is the formula used and illustrated in Boniface (pages 42-43) for reliability.