For two way ANOVA, we have one dependent variable and two independent variable.
Preconditions
The prerequisite of two way ANOVA is the same as one way ANOVA:
- inner-group Independence:
- random samples
- sample size < 10% total population
- inter-group Independence:
- not pairwise
- Normal Distribution
- if sample size >= 10, then we could still use ANOVA if condition not met
- if sample size < 10, we should use non parametric method if condition not met
- Homogeneity of variance test => variances of each group should be
equal
- if sample size of each group are equal then we could use ANOVA if condition not met
- if sample size of each group are not equal, but the std ratio between the largest and smallest > 2, then we could still use ANOVA if condition not met
Example
DV: math score IV: teaching method(r=2), scholarship(s=2) Sample Size: nAN = nAY = nBN = nBY = 10; n = 40
A | A | B | B |
---|---|---|---|
N | Y | N | Y |
77 | 96 | 93 | 74 |
88 | 87 | 94 | 88 |
77 | 94 | 95 | 77 |
85 | 90 | 83 | 93 |
81 | 80 | 94 | 91 |
72 | 99 | 94 | 95 |
80 | 100 | 85 | 85 |
80 | 87 | 91 | 88 |
76 | 96 | 90 | 93 |
84 | 95 | 96 | 79 |
- calculate the average math result of each group (AN,AY,BN,BY)
calculate the total average of all math results
calculate the average of group A and group B
calculate the effect of teaching method
calculate the effect of scholarship
hypothesis of teaching method
- H0: μA = μB => μA - μ = μB - μ = 0 only when μA = μB = μ
- HA: μA ≠ μB => μA - μ, μB - μ are not all 0
- hypothesis of scholarship
- H0: μN = μY => μN - μ = μY - μ = 0 only when μN = μY = μ
- HA: μN ≠ μY => μN - μ, μY - μ are not all 0
- hypothesis of interaction effect
- H0: μij - μi - μj + μ is equal to 0 to all i,j combinations
- H1: μij - μi - μj + μ is not equal to 0 to some i,j combinations
calculate the sum of squares total (SST)
calculate the sum of squares for teaching method (SSmethod)
calculate the sum of squares for scholarship(SSreward)
calculate the sum of squares for interaction effect
calculate the sum of squares error
calculate the mean of squares method
calculate the mean of squares reward
calculate the mean of squares interaction
calculate the mean of squares error
calculate the F-value
ANOVA Table
- | Df | Sum sq | Mean sq | F value | Pr(>F) |
---|---|---|---|---|---|
method | 1 | 72.9 | 72.9 | 2.16 | 0.15 |
reward | 1 | 129.6 | 129.6 | 3.83 | 0.06 |
Method:Reward | 1 | 774.4 | 774.4 | 22.91 | 2.9E-05 |
Residuals | 36 | 1215.0 | 33.8 | - | - |
As a result,
- math score is not influenced by teaching method
- math score is not influenced by scholarship reward
- math score is influenced by the interaction of teaching method and
scholarship reward
- the influence of teaching method on math score could be regulated by scholarship reward (A)
- the influence of scholarship reward on math score could be regulated by teaching method (B)
we need post hoc t-test to know exactly whether A is true or B is true