13.2 13.2 Inference for Two-Way ANOVA

When you complete this section, you will be able to:

  • Construct the two-way ANOVA table in terms of sources and degrees of freedom.

  • Summarize what the ANOVA table F tests can tell you about main effects and interactions and what they cannot without further analysis.

  • Interpret statistical software ANOVA output for a two-way ANOVA.

  • Use residual plots and sample statistics to check the assumptions of the two-way ANOVA model.

Inference for two-way ANOVA involves F statistics for each of the two main effects and an additional F statistic for the interaction. As with one-way ANOVA, the calculations are organized in an ANOVA table.

The ANOVA table for two-way ANOVA

Two-way ANOVA is the statistical analysis for a two-way design with a quantitative response variable. The results of a two-way ANOVA are summarized in an ANOVA table based on splitting the total variation SST and the total degrees of freedom DFT among the two main effects and the interaction. Both the sums of squares (which measure variation) and the degrees of freedom add:

SST = SSA + SSB + SSAB + SSE

DFT = DFA + DFB + DFAB + DFE

709

The sums of squares are always calculated in practice by statistical software. When the nij are not all equal, there are different ways to calculate the sums of squares, and some can give sums of squares that do not add. The degrees of freedom, on the other hand, will always add.

image

From each sum of squares and its degrees of freedom we find the mean square in the usual way:

The significance of each of the main effects and the interaction is assessed by an F statistic that compares the variation due to the effect of interest with the within-group variation. Each F statistic is the mean square for the source of interest divided by MSE. Here is the general form of the two-way ANOVA table:

Source Degrees of freedom Sum of squares Mean square F
A I − 1 SSA SSA/DFA MSA/MSE
B J − 1 SSB SSB/DFB MSB/MSE
AB (I − 1) (J − 1) SSAB SSAB/DFAB MSAB/MSE
Error SSE SSE/DFE
Total N − 1 SST

image

There are three null hypotheses in two-way ANOVA, with an F test for each. We can test for significance of the main effect of A, the main effect of B, and the AB interaction. It is generally good practice to examine the test for interaction first because the presence of a strong interaction may influence the interpretation of the main effects. Be sure to plot the means as an aid to interpreting the results of the significance tests.

SIGNIFICANCE TESTS IN TWO-WAY ANOVA

To test the main effect of A, use the F statistic

To test the main effect of B, use the F statistic

To test the interaction of A and B, use the F statistic

The P-value is the probability that a random variable having an F distribution with numerator degrees of freedom corresponding to the effect and denominator degrees of freedom equal to DFE is greater than or equal to the calculated F statistic.

710

The following example illustrates how to do a two-way ANOVA. As with the one-way ANOVA, we focus our attention on interpretation of the computer output.

EXAMPLE 13.8

A study of cardiovascular risk factors. A study of cardiovascular risk factors compared runners who averaged at least 15 miles per week with a control group described as “generally sedentary.’’ Both men and women were included in the study.6 The design is a 2 × 2 ANOVA with the factors group and sex. There were 200 subjects in each of the four combinations. One of the variables measured was the heart rate after six minutes of exercise on a treadmill. SAS computer analysis produced the outputs in Figure 13.4 and Figure 13.5.

image
Figure 13.4: FIGURE 13.4 Summary statistics for heart rates in the four groups of a 2 × 2 ANOVA, Example 13.8.

711

image
Figure 13.5: FIGURE 13.5 Two-way ANOVA output for heart rates, Example 13.8.

We begin with the usual preliminary examination. From Figure 13.4, we see that the ratio of the largest to the smallest standard deviation is less than 2. Therefore, we are not concerned about violating the assumption of equal population standard deviations. Normal quantile plots (not shown) do not reveal any outliers, and the data appear to be reasonably Normal.

image

The ANOVA table at the top of the output in Figure 13.5 is, in effect, a one-way ANOVA with four groups: female control, female runner, male control, and male runner. In this analysis, Model has 3 degrees of freedom and Error has 796 degrees of freedom. Because we will be relying on software to do all these calculations, it is always a good idea to do some quick arithmetic checks like degrees of freedom to make sure things make sense. The F test and its associated P-value for this analysis refer to the hypothesis that all four groups have the same population mean. We are interested in the main effects and interaction, so we ignore this test.

The sums of squares for the group and sex main effects and the group-by-sex interaction appear at the bottom of Figure 13.5 under the heading “Type I SS.’’ These sum to the sum of squares for Model. Similarly, the degrees of freedom for these sums of squares sum to the degrees of freedom for Model. Two-way ANOVA splits the variation among the means (expressed by the Model sum of squares) into three parts that reflect the two-way layout.

Because the degrees of freedom are all 1 for the main effects and the interaction, the mean squares are the same as the sums of squares. The F statistics for the three effects appear in the column labeled “F Value,’’ and the P-values are under the heading “Pr > F.’’ For the group main effect, we verify the calculation of F as follows:

712

image
Figure 13.6: FIGURE 13.6 Plot of the group means, with standard errors indicated, for heart rates in the 2 × 2 ANOVA, Example 13.8.

All three effects are statistically significant. The group effect has the largest F, followed by the sex effect and then the group-by-sex interaction. To interpret these results, we examine the plot of means, with bars indicating one standard error, in Figure 13.6. Note that the standard errors are quite small due to the large sample sizes. The significance of the main effect for group is due to the fact that the controls have higher average heart rates than the runners for both sexes. This is the largest effect evident in the plot.

The significance of the main effect for sex is due to the fact that the females have higher heart rates than the men in both groups. The differences are not as large as those for the group effect, and this is reflected in the smaller value of the F statistic.

The analysis indicates that a complete description of the average heart rates requires consideration of the interaction in addition to the main effects. The two lines in the plot are not parallel. This interaction can be described in two ways. The female-male difference in average heart rates is greater for the controls than for the runners. Alternatively, the difference in average heart rates between controls and runners is greater for women than for men. As the plot suggests, the interaction is not large. It is statistically significant because there were 800 subjects in the study.

Two-way ANOVA output for other software is similar to that given by SAS. Figure 13.7 gives the analysis of the heart rate data using Excel and Minitab.

713

image
Figure 13.7: FIGURE 13.7 Excel and Minitab two-way ANOVA outputs for the heart rate study, Example 13.8.