11.3: The Two-Way ANOVA Test
Learning Objectives
- Understand the difference in situations that allow for one-or two-way ANOVA methods.
- Know the procedure of two-way ANOVA and its application through technological tools.
- Understand completely randomized and randomized block methods of experimental design and their relation to appropriate ANOVA methods.
Introduction
In the previous section we discussed the one-way ANOVA method, which is the procedure for testing the null hypothesis that the population means and variances of a single independent variable are equal. Sometimes, however, we are interested in testing the means and variance of more than one independent variable. Say, for example, that a researcher is interested in determining the effects of different dosages of a dietary supplement on a physical endurance test in both males and females. The three different dosages of the medicine are (1) low, (2) medium and (3) high and the genders are (1) male and (2) female. Analyses with two independent variables, like the one just described, are called two-way ANOVA tests.
Dietary Supplement Dosage | Dietary Supplement Dosage | Dietary Supplement Dosage | ||
---|---|---|---|---|
Low | Medium | High | Total | |
Female | \begin{align*}35.6\end{align*} | \begin{align*}49.4\end{align*} | \begin{align*}71.8\end{align*} | \begin{align*}52.27\end{align*} |
Male | \begin{align*}55.2\end{align*} | \begin{align*}92.2\end{align*} | \begin{align*}110.0\end{align*} | \begin{align*}85.8\end{align*} |
Total | \begin{align*}45.2\end{align*} | \begin{align*}70.8\end{align*} | \begin{align*}90.9\end{align*} |
There are several questions that can be answered by a study like this, for example:
- Does the medication improve physical endurance, as measured by the test?
- Do males and females respond in the same way to the medication?
While there are similar steps in performing one- and two-way ANOVA tests, there are some major differences. In the following sections we will explore the differences in situations that allow for the one- or two-way ANOVA methods, the procedure of two-way ANOVA and the experimental designs associated with this method.
The Differences in Situations that Allow for One-or Two-Way ANOVA
As mentioned in the previous lesson, ANOVA allows us to examine the effect of a single independent variable on a dependent variable (i.e., the effectiveness of a reading program on student achievement). With two-way ANOVA we are not only able to study the effect of two independent variables (i.e., the effect of dosages and gender on the results of a physical endurance test) but also the interaction between these variables. An example of interaction between the two variables, gender and medication, is a finding that men and women respond differently to the medication.
We could conduct two separate one-way ANOVA tests to study the effect of two independent variables, but there are several advantages to conducting a two-way ANOVA.
- Efficiency. With simultaneous analysis of two independent variables, the ANOVA is really carrying out two separate research studies at once.
- Control. When including an additional independent variable in the study, we are able to control for that variable. For example, say that we included IQ in the earlier example about the effects of a reading program on student achievement. By including this, we are able to determine the effects of various reading programs, the effects of IQ and the possible interaction between the two.
- Interaction. With two-way ANOVA it is possible to investigate the interaction of two or more independent variables. In most real-life scenarios, variables do interact with one another. Therefore, the study of the interaction between independent variables may be just as important as studying the interaction between the independent and dependent variables.
When we perform two separate one-way ANOVA tests, we run the risk of losing these advantages.
Two-Way ANOVA Procedures
There are two kinds of variables in all ANOVA procedures – dependent and independent variables. In one-way ANOVA we were working with one independent variable and one dependent variable. In two-way ANOVA there are two independent variables and a single dependent variable. Changes in the dependent variables are assumed to be the result of changes in the independent variables.
In one-way ANOVA we calculated a ratio that measured the variation between the two variables (dependent and independent). In two-way ANOVA we need to calculate a ratio that measures not only the variation between the dependent and independent variables, but also the interaction between the two independent variables.
Before, when we performed the one-way ANOVA, we calculated the total variation by determining the variation within groups and the variation between groups. Calculating the total variation in two-way ANOVA is similar, but since we have an additional variable we need to calculate two more types of variation. Determining the total variation in two-way ANOVA includes calculating:
- Variation within the group (‘within-cell’ variation)
- Variation in the dependent variable attributed to one independent variable (variation among the row means)
- Variation in the dependent variable attributed to the other independent variable (variation among the column means)
- Variation between the independent variables (the interaction effect)
The formulas that we use to calculate these types of variation are very similar to the ones that we used in the one-way ANOVA. For each type of variation, we want to calculate the total sum of squared deviations (also known as the sum of squares) around the grand mean. After we find this total sum of squares, we want to divide it by the number of degrees of freedom to arrive at the mean squares, which allows us to calculate our final ratio. We could do these calculations by hand, but we have technological tools such as computer programs, Microsoft Excel, or a calculator to compute these figures much more quickly and accurately than we can. In order to perform a two-way ANOVA with a TI-83/84 calculator, you must download a calculator program at the following site.
http://www.wku.edu/~david.neal/statistics/advanced/anova2.htm
The process for determining and evaluating the null hypothesis for the two-way ANOVA is very similar to the same process for the one-way ANOVA. However, for the two-way ANOVA we have additional hypotheses due to the additional variables. For two-way ANOVA, we have three null hypotheses:
1. In the population, the means for the rows \begin{align*}(J)\end{align*} equals each other. In the example above, we would say that the mean for males equals the mean for females.
\begin{align*}H_0: \mu_1 = \mu_2 = \ldots = \mu_j\end{align*}
2. In the population, the means for the columns \begin{align*}(K)\end{align*} equals each other. In the example above, we would say that the means for the three dosages are equal.
3. In the population, the null hypothesis would be that there is no interaction between the two variables. In the example above, we would say that the there is no interaction between gender and amount of dosage.
\begin{align*}H_0: \text{all effects} = 0\end{align*}
Let’s take a look at an example of a data set and how we can interpret the summary tables produced by technological tools to test our hypotheses.
Example:
Say that the gym teacher is interested in the effects of the length of an exercise program on the flexibility of male and female students. The teacher randomly selected \begin{align*}48\end{align*} students (\begin{align*}24\end{align*} males and \begin{align*}24\end{align*} females) and assigned them to exercise programs of varying lengths (1, 2 or 3 weeks). At the end of the programs, she measured the flexibility and recorded the following results. Each cell represents the score of each student:
Length of Program | Length of Program | Length of Program | ||
---|---|---|---|---|
1 Week | 2 Weeks | 3 Weeks | ||
Gender | Females | \begin{align*}32\end{align*} | \begin{align*}28\end{align*} | \begin{align*}36\end{align*} |
\begin{align*}27\end{align*} | \begin{align*}31\end{align*} | \begin{align*}47\end{align*} | ||
\begin{align*}22\end{align*} | \begin{align*}24\end{align*} | \begin{align*}42\end{align*} | ||
\begin{align*}19\end{align*} | \begin{align*}25\end{align*} | \begin{align*}35\end{align*} | ||
\begin{align*}28\end{align*} | \begin{align*}26\end{align*} | \begin{align*}46\end{align*} | ||
\begin{align*}23\end{align*} | \begin{align*}33\end{align*} | \begin{align*}39\end{align*} | ||
\begin{align*}25\end{align*} | \begin{align*}27\end{align*} | \begin{align*}43\end{align*} | ||
\begin{align*}21\end{align*} | \begin{align*}25\end{align*} | \begin{align*}40\end{align*} | ||
Males | \begin{align*}18\end{align*} | \begin{align*}27\end{align*} | \begin{align*}24\end{align*} | |
\begin{align*}22\end{align*} | \begin{align*}31\end{align*} | \begin{align*}27\end{align*} | ||
\begin{align*}20\end{align*} | \begin{align*}27\end{align*} | \begin{align*}33\end{align*} | ||
\begin{align*}25\end{align*} | \begin{align*}25\end{align*} | \begin{align*}25\end{align*} | ||
\begin{align*}16\end{align*} | \begin{align*}25\end{align*} | \begin{align*}26\end{align*} | ||
\begin{align*}19\end{align*} | \begin{align*}32\end{align*} | \begin{align*}30\end{align*} | ||
\begin{align*}24\end{align*} | \begin{align*}26\end{align*} | \begin{align*}32\end{align*} | ||
\begin{align*}31\end{align*} | \begin{align*}24\end{align*} | \begin{align*}29\end{align*} |
Do gender and the length of an exercise program have an effect on the flexibility of students?
Solution:
From these data, we can calculate the following summary statistics:
Length of Program | Length of Program | Length of Program | ||||
---|---|---|---|---|---|---|
1 Week | 2 Weeks | 3 Weeks | Total | |||
Gender | Females | \begin{align*}\# (n)\end{align*} | \begin{align*}8\end{align*} | \begin{align*}8\end{align*} | \begin{align*}8\end{align*} | \begin{align*}24\end{align*} |
Mean | \begin{align*}24.6\end{align*} | \begin{align*}27.4\end{align*} | \begin{align*}41.0\end{align*} | \begin{align*}31.0\end{align*} | ||
St. Dev. | \begin{align*}4.24\end{align*} | \begin{align*}3.16\end{align*} | \begin{align*}4.34\end{align*} | \begin{align*}8.23\end{align*} | ||
Males | \begin{align*}\# (n)\end{align*} | \begin{align*}8\end{align*} | \begin{align*}8\end{align*} | \begin{align*}8\end{align*} | \begin{align*}24\end{align*} | |
Mean | \begin{align*}21.9\end{align*} | \begin{align*}27.1\end{align*} | \begin{align*}28.3\end{align*} | \begin{align*}25.8\end{align*} | ||
St. Dev. | \begin{align*}4.76\end{align*} | \begin{align*}2.90\end{align*} | \begin{align*}3.28\end{align*} | \begin{align*}4.56\end{align*} | ||
Totals | \begin{align*}\# (n)\end{align*} | \begin{align*}16\end{align*} | \begin{align*}16\end{align*} | \begin{align*}16\end{align*} | \begin{align*}48\end{align*} | |
Mean | \begin{align*}23.2\end{align*} | \begin{align*}27.3\end{align*} | \begin{align*}34.6\end{align*} | \begin{align*}28.4\end{align*} | ||
St. Dev. | \begin{align*}4.58\end{align*} | \begin{align*}2.93\end{align*} | \begin{align*}7.6\end{align*} | \begin{align*}7.10\end{align*} |
As we can see from the tables above, it appears that females have more flexibility than males and that the longer programs are associated with greater flexibility. Also, we can take a look at the standard deviations within each cell to get an idea of the variance within groups. This information is helpful, but it is necessary to calculate the test statistic to determine the effects and the interaction of the two independent variables.
Technology Note - Excel
Here is the procedure for performing a Two-way ANOVA in Excel using this set of data.
1. Copy and paste the above table into an empty Excel worksheet, without the labels, “Length of program” and “Gender.” Or use this table:
1 week | 2 weeks | 3 weeks | |
---|---|---|---|
Females | \begin{align*}32\end{align*} | \begin{align*}28\end{align*} | \begin{align*}36\end{align*} |
\begin{align*}27\end{align*} | \begin{align*}31\end{align*} | \begin{align*}47\end{align*} | |
\begin{align*}22\end{align*} | \begin{align*}24\end{align*} | \begin{align*}42\end{align*} | |
\begin{align*}19\end{align*} | \begin{align*}25\end{align*} | \begin{align*}35\end{align*} | |
\begin{align*}28\end{align*} | \begin{align*}26\end{align*} | \begin{align*}46\end{align*} | |
\begin{align*}23\end{align*} | \begin{align*}33\end{align*} | \begin{align*}39\end{align*} | |
\begin{align*}25\end{align*} | \begin{align*}27\end{align*} | \begin{align*}43\end{align*} | |
\begin{align*}21\end{align*} | \begin{align*}25\end{align*} | \begin{align*}40\end{align*} | |
Males | \begin{align*}18\end{align*} | \begin{align*}27\end{align*} | \begin{align*}24\end{align*} |
\begin{align*}22\end{align*} | \begin{align*}31\end{align*} | \begin{align*}27\end{align*} | |
\begin{align*}20\end{align*} | \begin{align*}27\end{align*} | \begin{align*}33\end{align*} | |
\begin{align*}25\end{align*} | \begin{align*}25\end{align*} | \begin{align*}25\end{align*} | |
\begin{align*}16\end{align*} | \begin{align*}25\end{align*} | \begin{align*}26\end{align*} | |
\begin{align*}19\end{align*} | \begin{align*}32\end{align*} | \begin{align*}30\end{align*} | |
\begin{align*}24\end{align*} | \begin{align*}26\end{align*} | \begin{align*}32\end{align*} | |
\begin{align*}31\end{align*} | \begin{align*}24\end{align*} | \begin{align*}29\end{align*} |
2. Select Data Analysis from the Tools menu and choose “ANOVA: Single-factor” from the list that appears
3. Place the cursor is in the “Input Range” field and select the entire table.
4. Place the cursor in the “Output Range” and click somewhere in a blank cell below the table.
5. Click “Labels” only if you have also included the labels in the table. This will cause the names of the predictor variables to be displayed in the table
6. Click OK and the results shown below will be displayed.
Note: The TI-83/4 requires a program to do a Two-way ANOVA test. See http://www.wku.edu/~david.neal/statistics/advanced/anova2.html
Using technological tools, we can generate the following summary table:
Source | \begin{align*}SS\end{align*} | \begin{align*}df\end{align*} | \begin{align*}MS\end{align*} | \begin{align*}F\end{align*} | Critical Value of \begin{align*}F^*\end{align*} |
---|---|---|---|---|---|
Rows (gender) | \begin{align*}330.75\end{align*} | \begin{align*}1\end{align*} | \begin{align*}330.75\end{align*} | \begin{align*}22.36\end{align*} | \begin{align*}4.07\end{align*} |
Columns (length) | \begin{align*}1,065.5\end{align*} | \begin{align*}2\end{align*} | \begin{align*}532.75\end{align*} | \begin{align*}36.02\end{align*} | \begin{align*}3.22\end{align*} |
Interaction | \begin{align*}350.00\end{align*} | \begin{align*}2\end{align*} | \begin{align*}175.00\end{align*} | \begin{align*}11.83\end{align*} | \begin{align*}3.22\end{align*} |
Within-cell | \begin{align*}621.00\end{align*} | \begin{align*}42\end{align*} | \begin{align*}14.79\end{align*} | ||
Total | \begin{align*}2,367.25\end{align*} |
\begin{align*}^*\end{align*} statistically significant at an \begin{align*}\alpha = .05\end{align*}
From this summary table, we can see that all three \begin{align*}F\end{align*} ratios exceed their respective critical values. This means that we can reject all three null hypotheses and conclude that:
- In the population, the mean for males differs from the mean of females.
- In the population, the means for the three exercise programs differ.
- For the interaction, there is an interaction between the length of the exercise program and the student’s gender.
Experimental Design and its Relation to the ANOVA Methods
Experimental design is the process of taking the time and the effort to organize an experiment so that the data are readily available to answer the questions that are of most interest to the researcher. When conducting an experiment using the ANOVA method, there are several ways that we can design an experiment. The design that we choose depends on the nature of the questions that we are exploring.
In a completely randomized design the subjects or objects are assigned to ‘treatment groups’ completely at random. For example, a teacher might randomly assign students into one of three reading programs to examine the effect of the different reading programs on student achievement. Often, the person conducting the experiment will use a computer to randomly assign subjects.
In a randomized block design, subjects or objects are first divided into homogeneous categories before being randomly assigned to a treatment group. For example, if the athletic director was studying the effect of various physical fitness programs on males and females, he would first categorize the randomly selected students into the homogeneous categories (males and females) before randomly assigning them to a one of the physical fitness programs that he was trying to study.
In ANOVA, we use both randomized design and randomized block design experiments. In one-way ANOVA we typically use a completely randomized design. By using this design, we can assume that the observed changes are caused by changes in the independent variable. In two-way ANOVA, since we are evaluating the effect of two independent variables we typically use a randomized block design. Since the subjects are assigned to one group and then another we are able to evaluate the effects of both variables and the interaction between the two.
Lesson Summary
1. With two-way ANOVA we are not only able to study the effect of two independent variables but also the interaction between these variables.
2. There are several advantages to conducting a two-way ANOVA including efficiency, control of variables and the ability to study the interaction between variables.
3. Determining the total variation in two-way ANOVA includes calculating:
- Variation within the group (‘within-cell’ variation)
- Variation in the dependent variable attributed to one independent variable (variation among the row means)
- Variation in the dependent variable attributed to the other independent variable (variation among the column means)
- Variation between the independent variables (the interaction effect)
4. It is more accurate and easier to use technological tools such as computer programs or Microsoft Excel to calculate the figures needed to evaluate our hypotheses tests.
Review Questions
- In two-way ANOVA, we study not only the effect of two independent variables on the dependent variable, but also the ___ between these variables.
- We could conduct multiple \begin{align*}t\end{align*}-tests between pair of hypotheses but there are several advantages when we conduct a two-way ANOVA. These include:
- Efficiency
- Control over additional variables
- The study of interaction between variables
- All of the above
- Calculating the total variation in two-way ANOVA includes calculating ___ types of variation.
- 1
- 2
- 3
- 4
A researcher is interested in determining the effects of different doses of a dietary supplement on a physical endurance test in both males and females. The three different doses of the medicine are (1) low, (2) medium and (3) high and the genders are (1) male and (2) female. He assigns \begin{align*}48\end{align*} people, \begin{align*}24\end{align*} males and \begin{align*}24\end{align*} females to one of the three levels of the supplement dosage and gives a standardized physical endurance test. Using technological tools, we generate the following summary ANOVA table
Source | \begin{align*}SS\end{align*} | \begin{align*}df\end{align*} | \begin{align*}MS\end{align*} | \begin{align*}F\end{align*} | Critical Value of \begin{align*}F^*\end{align*} |
---|---|---|---|---|---|
Rows (gender) | \begin{align*}14,832\end{align*} | \begin{align*}1\end{align*} | \begin{align*}14,832\end{align*} | \begin{align*}14.94\end{align*} | \begin{align*}4.07\end{align*} |
Columns (dosage) | \begin{align*}17,120\end{align*} | \begin{align*}2\end{align*} | \begin{align*}8,560\end{align*} | \begin{align*}8.62\end{align*} | \begin{align*}3.23\end{align*} |
Interaction | \begin{align*}2,588\end{align*} | \begin{align*}2\end{align*} | \begin{align*}1,294\end{align*} | \begin{align*}1.30\end{align*} | \begin{align*}3.23\end{align*} |
Within-cell | \begin{align*}41,685\end{align*} | \begin{align*}42\end{align*} | \begin{align*}992\end{align*} | ||
Total | \begin{align*}76,226\end{align*} | \begin{align*}47\end{align*} |
\begin{align*}^* \alpha = .05\end{align*}
- What are the three hypotheses associated with the two-way ANOVA method?
- What are the three null hypotheses?
- What are the critical values for each of the three hypotheses? What do these tell us?
- Would you reject the null hypotheses? Why or why not?
- In your own words, describe what these results tell us about this experiment.
Review Answers
- Interaction
- d
- d
- \begin{align*}H_0: \mu_M. = \mu_F., \ \ H_0: \mu_1. = \mu_2. = \mu_3., \ \ H_0: \text{all effects} = 0\end{align*}
- Answers may vary. They could include (1) \begin{align*}H_0: \mu_1.= \mu_2. = \ldots = \mu_j., \ H_0: \mu_1. = \mu_2. = \ldots = \mu_k., \ H_0: \mathrm{all\ effects} = 0\end{align*} or (2) written hypotheses that the means of the independent variable in the rows are equal to each other, the means of the independent variable in the rows columns are equal to each other and there is no interaction.
- The three critical values are \begin{align*}4.07, 3.23\end{align*} and \begin{align*}3.23\end{align*}. These values are derived from the \begin{align*}F\end{align*}-distribution. If the calculated \begin{align*}F\end{align*}-statistic exceeds these values, we will reject the null hypothesis.
- We would reject the first two null hypotheses and fail to reject the third null hypothesis.
- We can conclude that not all means in the populations are equal with regard to gender and drug dosage. Because the \begin{align*}F\end{align*}-ratio for the interaction effect (gender \begin{align*}x\end{align*} drug dosage) was not statistically significant, the conclusion is that there is no difference in the performance of the male and female rats across the levels of drug dosage.