Two-Way ANOVA 

[This module is NOT covered on the NSOE diagnostic exam.]


In the oneway ANOVA module, we looked at a one factor experimental design comparing corn stalk growth across fertilizer treatment. In this module we will expand on this design by adding a second factor–irrigation. Within each fertilizer group (100 corn stalks), we will treat 4 groups (25 corn stalks each) with a different irrigation treatment (none, low, medium, heavy) with 75 corn stalks receiving each irrigation treatment. This will give us a balanced design with (equal number of individuals across treatment types). The table below lists the counts for each type of treatment.




After conducting our experiment of the two treatments, we measure our corn stalk growth after four weeks. The box plot of the data organized by the two factors are shown here. The box plot was made in STATA:

(STATA command: graph box y, over(fertilizer) over(irrigation)).  




As you can see, under irrigation groups one through three (no irrigation, light irrigation, medium irrigation), median corn stalk growth is greatest with the Green Grow Fertilizer (group 3). This pattern does not hold for the heavy irrigation group. We could also run side-by-side box plots on each individual factor.


Before we conduct our two-way ANOVA, we should set up our hypotheses. These hypotheses are similar to the oneway ANOVA, with one added caveat–there may be an interaction between the two factors. If an interaction effect is significant, this would mean that the effect of fertilizer of corn stalk growth depends on the level of irrigation (or vice versa). In other words, there is some multiplicative effect between fertilizer type and irrigation level. We then have three null hypotheses (and three alternatives).


Fertilizer groups:

Ho: μ1 = μ2 =μ3 (where 1, 2 and 3 are fertilizer groups)

Ha: At least one population mean of corn stalk height is different from the others across fertilizer treatment


Irrigation groups:

Ho: μA = μB = μC = μD

 (where A, B, C and D are irrigation treatments)

 Ha: At least one population mean of corn stalk height is different from the others across irrigation treatment


Interaction effects:

Ho: There is no interaction effect between fertilizer and irrigation level on corn stalk height

Ha: There is an interaction effect between fertilizer and irrigation level on corn stalk height


Using STATA, first we ran the two-way ANOVA with the interaction effect. The state command is (the variables are in pink, the STATA code is in blue):

anova y fertilizer irrigation fertilizer##irrigation.

TwoWay ANOVA Table with Interaction Term


As you can see, the table is quite similar to the one-way ANOVA table. STATA calculated the (partial) sum of squares, the degrees of freedom and the mean sum of squares for each of the factors (fertilizer and irrigation), as well as the interaction terms. Let’s look at the interaction first (to decide whether to include the interaction effect in the final model). The F-statistic is quite small, with an associated large p-value. We can not reject the null hypothesis and therefore conclude that there is no statistically significant interaction effect between fertilizer and irrigation on corn stalk height. Based on these results I would drop the interaction effect from the model and rerun the two-way ANOVA.


TwoWay ANOVA Table without Interaction Term


As you can see in the two-way ANOVA table above, the fertilizer treatment was found to be statistically significant, while the irrigation treatment was not. We can reject the fertilizer null hypothesis and safely conclude that at least one of the population means across fertilizer treatments is different than the others. Based on these results we can NOT conclude which mean was different nor by how much. To do so, one could conduct post-hoc comparisons such as the Bonferroni, Tukey or Scheffe tests (or others). It is important NOT to run multiple t-tests across groups at this point in the analysis. When you run many t-tests across all of the group combinations you run in to the  possibility of finding significance when significance doesn’t exist (an increased Type I error rate). The post-hoc comparisons deal explicitly with this issue and therefore should be used instead of multiple t-tests. A module will be developed to cover post-hoc comparisons.


To ensure that our results are valid, we also need to check the assumptions of the two-way ANOVA. The assumptions are quite similar to the one-way ANOVA, but now we need to apply them to each of the groups (12 instead of three). Based on the box plot above, we can be fairly confident on the validity of the first three assumptions. We could test for the equality of variance across groups with a statistical test. We must also assume that observations are independent within and between groups, a case that would hold if no spatial autocorrelation exists in our observations.

ANOVA Assumptions


1. The population values of each group should be normally distributed.


2. The variance of the population values of each group should be approximately equal.


3. Outliers should be rare. This is most important when you have an unbalanced design.


4. The observations should be independent within and across groups.