Two-Way ANOVA - El Camino College

Download Report

Transcript Two-Way ANOVA - El Camino College

+
Discovering Statistics
2nd Edition Daniel T. Larose
Chapter 12:
Analysis of Variance
Lecture PowerPoint Slides
+ Chapter 12 Overview

12.1 One-Way Analysis of Variance (ANOVA)

12.2 Multiple Comparisons

12.3 Randomized Block Design

12.4 Two-Way ANOVA
2
+ The Big Picture
Where we are coming from and where we are headed…
In Chapters 8–10, we learned statistical inference for continuous
random variables and in Chapter 11 we learned hypothesis tests for
categorical variables.

Here in Chapter 12, we are introduced to analysis of variance, a
way to compare the population means of several different groups,
and determine whether significant differences exist between the
means.

In the final two chapters, we will learn about inference for
regression and nonparametric statistics.

3
+ 12.1: One-Way ANOVA
Objectives:

Explain how ANOVA works.

Perform ANOVA.
4
5
How ANOVA Works
Analysis of variance (ANOVA) is a hypothesis test for determining
whether three or more means of different populations are equal.
ANOVA works by comparing the variability between the samples to
the variability within the samples.
Requirements for Performing ANOVA
1. Each of the k populations is normally distributed.
2. The variances (σ2) of the populations are all equal.
3. The samples are independently drawn.
Procedure for Verifying the Requirements for ANOVA
1. Normality: Check that the data from each group are normally
distributed, using normal probability plots.
2. Equal Variances: Compute the sample standard deviation for
each group to verify that the largest standard deviation is not larger
than twice the smallest standard deviation.
3. Independence: Verify that the samples are independently drawn.
6
Measuring Variabilities
We use the following statistics to measure the variabilities between and
within the samples.
The mean square treatment (MSTR) measures the variability in the
sample means. MSTR is the sample variance of the sample means,
weighted by the sample size.
 ni (x i  x )2
MSTR 
k 1
The mean square error (MSE) measures the variability within the samples.
MSE is the mean of the sample variances, weighted by sample size.
 (n
MSE 

i
1)si2
nt  k
The test statistic for ANOVA is:

Fdata 

MSTR
MSE
7
Example
Consider the summary statistics for GPAs for dorms A, B, and C.
Calculate the SSTR, SSE, SST, MSTR, MSE, and Fdata.
k = 3 dormitories, and total sample size nt = 10 + 10 + 10 = 30

• a. SSTR  ni x i  x

2
 10  2.2  2.5   10  2.5  2.5   10  2.8  2.5 
2
 10  0.3  02  0.32   1.8


2
2
2
8
Example
SSE ≈ (10 – 1)1.1334607772 + (10 – 1)1.0308572482
+ (10 – 1)0.93702842 ≈ 29.0288
SST = SSTR + SSE = 1.8 + 29.0288 = 30.8288
SSTR 1.8
MSTR 

 0.9
 k  1 3  1
Fdata
SSE
29.0288
MSE 

1.0751407407
 nt  k  30  3
MSTR
0.9


MSE 1.0751407407
 0.8370997079
 0.84
9
Performing One-Way ANOVA
One-Way Analysis of Variance
We have taken random samples from k populations and want to
test whether the population means are all equal. Conditions:
1. Each of the k populations is normally distributed.
2. The variances (σ2) of the populations are all equal.
3. The samples are independently drawn.
Step 1: State the hypotheses and rejection rule.
Step 2: Calculate Fdata
MSTR
Fdata 
MSE
where Fdata follows an F distribution with df1 = k – 1 and df2 = nt – k.
Step 3: Find the p-value.
Step 4: State the conclusion and the interpretation.
10
Example
Consider the summary statistics for GPAs for dorms A, B, and C.
Test whether the population mean GPAs differ among the students
in the three dormitories. Use a = 0.05.
H0: μA = μB = μC
Ha: not all the population means are equal
μi represents the GPA of students from dormitory i.
Rejection rule: Reject H0 if p-value < a.
11
Example
The conditions are checked in Example 12.1.
Also, in a previous example, we calculated
MSTR = 0.9, MSE = 1.0751407407
Fdata
MSTR
0.9


 0.8370997079
MSE 1.0751407407
Fdata follows an F distribution with df1 = k – 1 = 3 – 1 = 2 and df2 = nt – k
= 30 – 3 = 27
We find the p-value to be P(F > 0.8370997079) = 0.4438929572 ≈
0.4439.
Since this p-value is > 0.05, we do not reject the null hypothesis. There
is not enough evidence to conclude that not all of the mean GPAs are
equal.
+ 12.2: Multiple Comparisons
12
Objectives:

Perform multiple comparisons tests using the Bonferroni method.

Use Tukey’s test to perform multiple comparisons.
Use confidence intervals to perform multiple comparisons for
Tukey’s test.

13
Multiple Comparisons
When we perform one-way ANOVA, we may determine not all
population means are the same. However, we do not test to find out
which pairs of population means are significantly different.
Multiple Comparisons
Once an ANOVA result has been found significant (the null hypothesis is
rejected) multiple comparisons procedures seek to determine which pairs
of population means are significantly different. Multiple comparisons are not
performed if the ANOVA null hypothesis has not been rejected.
We shall learn three multiple comparisons procedures:
• The Bonferroni Method
• Tukey’s Test
• Tukey’s Test using Confidence Intervals
14
The Bonferroni Method
To determine which pairs of population means are significantly
different, we test each pair of means using a slightly different test
statistic t and apply the Bonferroni adjustment to the p-value.
The Bonferroni Adjustment
When performing multiple comparisons, the experimentwise error rate
aEW is the probability of making at least one Type I error in the set of
hypothesis tests.
• aEW is always greater than the comparison level of significance a by
a factor approximately equal to the number of comparisons being
made.
• Thus, the Bonferroni adjustment corrects for the experimentwise
error rate by multiplying the p-value of each pairwise hypothesis
test
by the number of comparisons being made. If the Bonferroniadjusted p-value is greater than 1, then set it equal to 1.
15
Tukey’s Test
Tukey’s Test for Multiple Comparisons
Tukey’s Method requires that the conditions for ANOVA have been met
and that the null hypothesis of equal means has been rejected.
Step 1: For each of the c hypothesis tests, state the hypotheses.
Step 2: Find the Tukey critical value and state the rejection rule.
Step 3: Calculate the Tukey test statistic q for each hypothesis test.
x0  x1
qdata 
MSE  1 1 
   
2  n0 n1 
Step 4: For each hypothesis test, state the conclusion and the interpretation.
Multiple Comparisons
If a 100(1 – a)% confidence interval for µ1 – µ2 contains zero, then at level of
significance awe do not reject the null hypothesis H0: µ1 = µ2. If the interval
does not contain zero, then we do reject the null hypothesis.
+ 12.3: Randomized Block Design
16
Objective:
Explain the power of the randomized block design and perform a
randomized block design ANOVA.

17
Randomized Block Design
In the appropriate circumstances, we can use the randomized block
design to improve the ability of the ANOVA to find significant
differences among the treatment means.
A blocking factor, or block, is a variable that is not of primary interest to
the researcher but is included in the ANOVA in order to improve the ability of
the ANOVA to find significant differences among the treatment means. In a
randomized block design ANOVA, we test for differences among the
treatment means, while accounting for the variability among the levels in the
blocking factor.
18
Randomized Block Design
Note the following facts about the ANOVA table for randomized
block design:
• SSTR, its df, k – 1, and MSTR are all the same quantities as in the
one-way ANOVA table.
• SSERBD is denoted simply as SSE.
• Quantities in the Mean Square column equal the ratio of the
quantities in the sum of squares column divided by their
respective degrees of freedom.
• We have SST = SSTR + SSB + SSE, and the 3 df sum to nT – 1.
• Since we are not interested in the blocks and thus the mean
square blocks MSB, there is no F statistic for blocks.
• In RBD, the error df is broken down into the df for SSB, b – 1, and
the df for the new SSE, (k – 1)(b – 1).
+ 12.4: Two-Way ANOVA
Objectives:

Construct and interpret an interaction graph.

Perform a two-way ANOVA.
19
20
Interaction Graph
It is important when performing two-way ANOVA to check for the
presence of interaction between the factors.
Interaction exists between two factors when the effect of one factor
depends on the level of the other factor.
An interaction plot is a graphical representation of the cell means for each
cell in the contingency table. To construct an interaction plot:
1. Compute the cell means for all cells.
2. Construct an x – y plot (Cartesian plane). Label the horizontal axis
for each level of Factor A. The vertical axis represents the response
variable.
3. For the first level of Factor A, insert a point at a height representing
the cell means for the response variable for each level of Factor B.
Then do this for the other levels of Factor A.
4. Connect the points that have a common Factor B level.
21
Two-Way ANOVA
The requirements for performing two-way ANOVA are the same as
for one-way ANOVA:
1. Each of the k populations is normally distributed.
2. The variances (σ2) of the populations are all equal.
3. The samples are independently drawn.
Two-way ANOVA involves a series of three hypothesis tests:
1. Test for interaction between the factors.
2. Test for Factor A effect.
3. Test for Factor B effect.
Warning!
If there is interaction between the factors, then we cannot draw conclusions
about the main effects. If the test for interaction produces evidence that
interaction is present, then do not perform the test for either Factor A or B.
+ Chapter 12 Overview

12.1 One-Way Analysis of Variance (ANOVA)

12.2 Multiple Comparisons

12.3 Randomized Block Design

12.4 Two-Way ANOVA
22