Two-way ANOVA  formula

Outline:

definitional formula
partitioning variance
comparing variances
example

 

 

definitional formula

ANOVA:

1. Partition Variance into components associated with the sources of variability

2. Compare the variances to determine if part due to something of interest is large with respect to variability within groups

One-way ANOVA broke total variance into IV and Error. Then compared the effect of the IV to error variance to see if it was a meaningfully large effect.

Two-way ANOVA, interested in Main Effect of A, Main Effect  of B, Interaction of A and B. Thus we will partition variance into parts caused by IVA, IVB, IntAxB, and Error. Then we will compare the variance associated with each thing of interest to error variance to see if each effect is meaningful.

Language issues again:

Xiab : X - score; i - an individual; a - level of IVA, b - level of IVB

Each cell will have a Mean: MA,B

There will be marginal Means associated with each level of each IV.
 
IV  A .
IV B
A = 1
A = 2
marginal Means
    B = 1
M1,1
    X1,1,1

    X2,1,1

    X3,1,1

so on to
    Xn,1,1
M2,1
    X1,2,1

    X2,2,1

    X3,2,1

so on to
    Xn,2,1
MB=1
    B = 2
M1,2
    X1,1,2

    X2,1,2

    X3,1,2

so on to
    Xn,1,2
M2,2
    X1,2,2

    X2,2,2

    X3,2,2

so on to
    Xn,2,2
MB=2
marginal Means MA=1 MA=2 MT

Partitioning Variance

To get to variance, we go through several steps. Variance is SS/df, and SS is the sum of the squared deviations. So we will start at the deviations level and partition the deviation into components for each source. These things are based on the math way of looking at MEs and interactions.

Note what is missing in the ANOVA definitions -- ANOVA defines Main Effects as overall differences among levels of IV, but is not concerned that the differences are consistent across the levels of the other IV.

Deviations

DevT = Xiab - MT
DevA = MA - MT
Math on the A marginals; due to 1st IV; is there an overall difference among levels of A
DevB = MB - MT
Math on the B marginals; due to 2nd IV;  is there an overall difference among levels of B
DevE = Xiab - MAB
variability within the group; in this case the cell
DevAxB = MAB - MA - MB + MT
This is based on predicting cell mean from the marginals; due to the interation; are things additive

 

 

DevT = DevA + DevB + DevAxB + DevE

Sums of Squares

SST = SUMbSUMaSUMi(Xiab - MT)2
SSA = SUMbSUMaSUMi(MA - MT)2
SSB = SUMbSUMaSUMi(MB - MT)2
SSAxB = SUMbSUMaSUMi(MAB - MA - MB + MT)2
SSE = SUMbSUMaSUMi(Xiab - MAB)2

 

 

Yes things add up at this level

SST = SSA+ SSB + SSAxB + SSE

 

 

degrees of freedom

dfT = NT - 1
dfA = A - 1
dfB = B - 1
dfAxB = (A - 1)(B - 1)
dfE = NT - A x B

 

 

Things add up at this level as well:

dfT = dfA + dfB + dfAxB + dfE

Mean Squares (Variances)

MSA = SSA / dfA
MSB = SSB / dfB
MSAxB = SSAxB / dfAxB
MSE = SSE / dfE

 

 

Things don't add up at this level, so don't compute total variance. At this point, however, you have completed the first part of an ANOVA -- partitioning variance (this is where all the math work is).

Comparing Variances

Usually present the comparison of variances (in which you see if the effects of interest are big compared to variability within groups) in a source table. The F statistic is the comparison of the MS for each effect to the MSE. This allows you to check how likely it is to get an effect that size given chance (the p level!). You can then decide if you think the effect is just due to chance (not significant) or so unlikely that you assume it is caused by something.
 
Source
SS
df
MS
F
p
b/t factors
.
.
.
.
.
    A
SSA
dfA 
MSA
F = MSA / MSE
.
    B
SSB 
dfB 
MSB 
F = MSB / MSE
.
interaction
.
.
.
.
.
    A x B
SSAxB 
dfAxB 
MSAxB 
F = MSAxB / MSE
.
error
SSE 
dfE
MSE 
.
.
total
SST
dfT
.
.
.

The basic issue here: Is the size of my effect (or interaction) so large compared what to would be expected given the variability within my groups that it is very unlikely that the effects are due to chance? If so, then assume the differences observed were caused by the IV (or the interaction).