A two-way analysis of variance (ANOVA) is used to determine whether or not there is a statistically significant difference between the means of three or more independent groups that have been split on two factors. The purpose of a two-way ANOVA is to determine how two factors impact a response variable, and to determine whether or not there is an interaction between the two factors on the response variable.
Here are a couple examples of when you might conduct a two-way ANOVA:
Example 1: You want to determine if exercise (no exercise, light exercise, intense exercise) and gender (male, female) impact weight loss. In this case, the two factors you’re studying are exercise and gender and your response variable is weight loss (measured in pounds). You can conduct a two-way ANOVA to determine if exercise and gender impact weight loss and to determine if there is an interaction between exercise and gender on weight loss.
Example 2: You want to determine if sunlight exposure (no sunlight, low sunlight, medium sunlight, high sunlight) and watering frequency (daily, weekly) impact the growth of a certain plant. In this case, the two factors you’re studying are sunlight exposure and watering frequency and your response variable is plant growth (measured in inches). You can conduct a two-way ANOVA to determine if sunlight exposure and watering frequency impact plant growth and to determine if there is an interaction between sunlight exposure and watering frequency on plant growth.
This type of test is called a two-way ANOVA because we are analyzing how two factors impacts our response variable.
Two-Way ANOVA Assumptions
Before we can conduct a two-way ANOVA, we need to make sure the following assumptions are met:
1. Normality – your dependent variable should be approximately normally distributed for each combination of the groups of the two factors.
2. Equal Variance – the variances for each combination of the groups of the two factors are equal or approximately equal.
3. Independence – the observations in each group need to be independent of each other. Usually a randomized design will take care of this.
If these assumptions are met, then we can proceed with conducting a two-way ANOVA.
Example of a Two-Way ANOVA
We want to know whether or not plant growth is influenced by sunlight exposure (none, low, medium, high) and watering frequency (daily, weekly). In total, we plant 40 seeds of a certain type of plant and grows them for two months under different sunlight and watering conditions. At the end of two months, we measure and record the height (in inches) of each plant. The results are shown below:
In the table above, we see that there were five plants grown under each combination of conditions. For example, there were five plants grown with daily watering and no sunlight and their heights after two months were 4.8 inches, 4.4 inches, 3.2 inches, 3.9 inches, and 4.4 inches:
To determine if plant growth is influenced by sunlight exposure and watering frequency, we conduct a two-way ANOVA.
You can conduct a two-way ANOVA using many different types of software like Excel, R, SPSS, SAS, etc. but here we will demonstrate how to conduct a two-way ANOVA in Excel.
Two-Way ANOVA in Excel
Step 1. Enter Data
Enter the data into Excel using the format below:
Step 2. Click the “Data” tab, then click “Data Analysis.” If you don’t see the “Data Analysis” option, then install the free Data Analysis toolpak.
Step 3. Click “Anova: Two-Factor With Replication”, then click “OK.” The two-way ANOVA window will open.
We choose “Anova: Two-Factor With Replication” because we have five plants that were grown under each combination of sunlight and watering. If we only had one plant grown under each combination, we would choose “Anova: Two-Factor Without Replication.”
Step 4. Fill in the necessary information in the two-way ANOVA window.
Select your entire dataset range (including the headers) for the “Input Range:” option. In our case, our data is located in cells $A$1:$E$11.
Then, enter the number of “Rows per sample”, which is the number of observations that show up for each combination. Recall that we have five plants that were grown under each combination, so we’ll enter “5” here.
Then, choose a level for “Alpha.” We’ll choose 0.05. Other common choices are .01, .05, and .10.
Lastly, choose an output range to display the results of the two-way ANOVA. We’ll choose cell $G$4 since it’s right next to our data.
Then click “OK.”
Interpreting the output of a two-way ANOVA
Once we complete the steps above, Excel will generate the following output:
We are mostly interested in the ANOVA table at the bottom of the output. This table shows the F-value and corresponding P-value for our factors “sunlight exposure”, “watering frequency”, and the interaction between these two factors.
From the output, we see that the p-value for the interaction between watering frequency and sunlight exposure is 0.310989, which is greater than our alpha level of 0.05 This indicates that there is no significant interaction between watering frequency and sunlight exposure on plant height.
If we created a line chart to show the average plant height for different levels of sunlight exposure for both daily watering and weekly watering, it would look like this:
In general, when the lines are roughly parallel on a chart like this, it indicates a lack of interaction between the two factors. Conversely, when the lines are not roughly parallel, it indicates an interaction.
Since the lines are roughly parallel in this chart, it indicates that there isn’t a strong interaction between sunlight exposure and daily watering. Our p-value (.310989 > .05) confirms this.
We also see that the p-value for watering frequency is 0.975, which is greater than our alpha level of 0.05. This indicates that watering frequency has no significant influence on plant height.
We also see that the p-value for sunlight exposure is 3.9E-08 (equivalent to 0.000000039), which is less than our alpha level of 0.05. This indicates that sunlight exposure has a significant influence on plant height.