Example: Corn Yield

Chapter 14
Comparing Groups: Analysis
of Variance Methods
Section 14.3
Two-Way ANOVA
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Type of ANOVA
One-way ANOVA is a bivariate method:
 It has a quantitative response variable
 It has one categorical explanatory variable
Two-way ANOVA is a multivariate method:
 It has a quantitative response variable
 It has two categorical explanatory variables
3
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Example: Amounts of Fertilizer and
Manure
A recent study at Iowa State University:
 A field was portioned into 20 equal-size plots.
 Each plot was planted with the same amount of
corn seed.
 The goal was to study how the yield of corn later
harvested depended on the levels of use of
nitrogen-based fertilizer and manure.
 Each factor (fertilizer and manure) was measured
in a binary manner.
4
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Example: Amounts of Fertilizer and
Manure
There are four treatments you can compare with this
experiment found by cross-classifying the two binary
factors: fertilizer level and manure level.
Table 14.7 Four Groups for Comparing Mean Corn Yield
These result from the two-way cross classification of fertilizer level with manure level.
5
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Example: Amounts of Fertilizer and
Manure
Inference about Effects in Two-Way ANOVA
In two-way ANOVA, a null hypothesis states that the
population means are the same in each category of one
factor, at each fixed level of the other factor.
We could test:
H 0 : Mean corn yield is equal for plots at the low and
high levels of fertilizer, for each fixed level of manure.
6
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Example: Amounts of Fertilizer and
Manure
We could also test:
H0
: Mean corn yield is equal for plots at the low and
high levels of manure, for each fixed level of fertilizer.
The effect of individual factors tested with the two null
hypotheses (the previous two pages) are called the main
effects.
7
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Assumptions for the Two-way ANOVA
F-test
 The population distribution for each group is normal.
 The population standard deviations are identical.
 The data result from a random sample or randomized
experiment.
8
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
SUMMARY: F-test Statistics in Two-Way
ANOVA
For testing the main effect for a factor, the test statistic is
the ratio of mean squares:
MS for the factor
F
MS error


9
The MS for the factor is a variance estimate
based on between-groups variation for that factor.
The MS error is a within-groups variance estimate
that is always unbiased.
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
SUMMARY: F-test Statistics in Two-Way
ANOVA
10

When the null hypothesis of equal population means
for the factor is true, the F-test statistic values tend to
fluctuate around 1.

When it is false, they tend to be larger.

The P-value is the right-tail probability above the
observed F-value.
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Example: Corn Yield
Data and sample statistics for each group:
Table 14.9 Corn Yield by Fertilizer Level and Manure Level
11
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Example: Corn Yield
Output from Two-way ANOVA:
Table 14.10 Two-Way ANOVA for Corn Yield Data in Table 14.9
12
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Example: Corn Yield
First consider the hypothesis:
H0
: Mean corn yield is equal for plots at the low and
high levels of fertilizer, for each fixed level of manure.
From the output, you can obtain the F-test statistic of
6.33 with its corresponding P-value of 0.022.
The small P-value indicates strong evidence that the
mean corn yield depends on fertilizer level.
13
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Example: Corn Yield
Next consider the hypothesis:
H0
: Mean corn yield is equal for plots at the low and
high levels of manure, for each fixed level of fertilizer.
From the output, you can obtain the F-test statistic of
6.88 with its corresponding P-value of 0.018.
The small P-value indicates strong evidence that the
mean corn yield depends on manure level.
14
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Exploring Interaction between Factors in
Two-Way ANOVA
No interaction between two factors means that the
effect of either factor on the response variable is the
same at each category of the other factor.
15
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Exploring Interaction between Factors in
Two-Way ANOVA
Figure 14.5 Mean Corn Yield, by Fertilizer and Manure Levels, Showing No Interaction.
16
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Exploring Interaction between Factors in
Two-Way ANOVA
A graph showing interaction:
Figure 14.6 Mean Corn Yield, by Fertilizer and Manure Levels, Displaying Interaction.
17
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Testing for Interaction
In conducting a two-way ANOVA, before testing the
main effects, it is customary to test a third null hypothesis
stating that their is no interaction between the factors in
their effects on the response.
18
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Testing for Interaction
The test statistic providing the sample evidence of
interaction is:
MS for interactio n
F
MS for error
When
H0
19
is false, the F-statistic tends to be large.
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Example: Corn Yield Data
ANOVA table for a model that allows interaction:
Table 14.14 Two-Way ANOVA of Mean Corn Yield by Fertilizer Level and Manure
Level, Allowing Interaction
20
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Example: Corn Yield Data
The test statistic for
H0
: no interaction is:
F = (MS for interaction)/(MS error) = 3.04 / 2.78 = 1.10
ANOVA table reports corresponding P-value of 0.311
 There is not much evidence of interaction.
H 0 at the usual significance
 We would not reject
levels, such as 0.05.
21
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Check Interaction Before Main Effects
In practice, in two-way ANOVA, you should first test
the hypothesis of no interaction.
It is not meaningful to test the main effects hypotheses
when there is interaction.
22
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Check Interaction Before Main Effects
If the evidence of interaction is not strong (that is, if the
P-value is not small), then test the main effects
hypotheses and/or construct confidence intervals for
those effects.
23
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Check Interaction Before Main Effects
If important evidence of interaction exists, plot and
compare the cell means for a factor separately at each
category of the other factor.
24
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Why Not Instead Perform Two Separate
One-Way ANOVAs?
When you have two factors, you could perform two
separate One-Way ANOVAs rather than a Two-Way
ANOVA but
 you learn more with a Two-Way ANOVA -it
indicates whether there is interaction.
 more cost effective to study the variables together
rather than running two separate experiments.
 the residual variability tends to decrease so we get
better predictions, larger test statistics and hence
greater power for rejecting false null hypotheses.
25
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Factorial ANOVA
The methods of two-way ANOVA can be extended to
the analysis of several factors. A multifactor ANOVA with
observations from all combinations of the factors is called
factorial ANOVA, e.g., with three factors - three-way
ANOVA considers main effects for all three factors as
well as possible interactions.
26
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.
Use Regression With Categorical and
Quantitative Predictors
In practice, when you have several predictors, both
categorical and quantitative, it is sensible to build a
multiple regression model containing both types of
predictors.
27
Copyright © 2013, 2009, and 2007, Pearson Education, Inc.