Chapter 12: Analysis of Variance
Download
Report
Transcript Chapter 12: Analysis of Variance
Chapter 12: Analysis of
Variance
Rep
Tillage
Plow
V-chisel
Coulter chisel
Std. chisel
Hvy. disk
Lt. disk
I
118.3
115.8
124.1
109.2
118.1
118.3
II
125.6
122.5
118.5
114.0
117.5
113.7
III
123.8
118.9
113.3
122.5
121.4
113.7
Tillage
Average
122.6
119.1
118.6
115.2
119.0
115.2
Chapter Goals
• Test a hypothesis about several means.
• Consider the analysis of variance
technique (ANOVA).
• Restrict the discussion to single-factor
ANOVA.
12.1: Introduction to the
Analysis of Variance
Technique
• Compare several means simultaneously.
• The analysis of variance technique allows
us to test the null hypothesis that all means
are equal against the alternative hypothesis
that at least one mean value is different,
with a specified value of a.
Example: A study was conducted to determine if the drying
time for a certain paint is affected by the type of applicator
used. The data in the table below represents the drying time
(in minutes) for 3 different applicators when the paint was
applied to standard wallboard. Is there any evidence to
suggest the type of applicator has a significant effect on the
paint drying time at the 0.05 level?
Note:
1. The type of applicator is a level.
2. The data values from repeated samplings are called
replicates.
Sample Results:
Applicator (Level)
Brush
Roller
(i = 1 )
(i = 2)
39.1
31.6
39.4
33.4
31.1
30.2
33.7
41.8
30.5
33.9
34.6
Sum
C1 208.4
C2 170.9
Pad
(i = 3)
32.7
33.2
28.7
29.2
25.8
31.4
26.7
29.5
C3 237.2
Mean
x1 34.73
x 2 34.18
x 3 29.65
Note:
1. The drying time is measured by the mean value.
x i is the mean drying time for level i, i = 1, 2, 3.
2. There is a certain amount of variation among the means.
3. Some variation can be expected, even if all three
population means are equal.
4. Consider the question: “Is the variation among the sample
means due to chance, or it is due to the effect of applicator
on drying time?”
5. You might consider a dotplot of the data to see if the
graphs suggests a difference among the levels?
Solution:
1. The Set-up:
a. Population parameter of concern: The mean at each level
of the test factor. Here, the mean drying time for each
applicator.
b. The null and the alternative hypothesis:
H0: m1 = m2 = m3
The mean drying time is the same for each applicator.
Ha: mi mj for some i j
Not all drying time means are equal.
2. The Test Criteria:
a. Assumptions: The data was randomly collected and all
observations are independent. The effects due to chance
and untested factors are assumed to be normally
distributed.
b. Test statistic: F test statistic (see below).
c. Level of significance: a = 0.05
3. The Sample Evidence:
a. Sample information: Data listed in the given table.
b. Calculate the value of the test statistic:
The F statistic is a ratio of two variances.
Separate the variance in the entire data set into two parts.
Partition the Total Sum of Squares:
Consider the numerator of the fraction used to define the
sample variance:
2
(
x
x
)
s2
n 1
The numerator of this fraction is called the sum of squares, or
total sum of squares.
Notation:
Ci total for column i
ki number of observatio ns for level i
n ki total number of observatio ns
2
x
SS(total) ( x 2 )
n
total variation in the data
C12
C22
C32
2
x
SS(factor)
k
k
k
n
2
3
1
variation between factor levels
2
2
2
C
C
C
2
3
1
2
SS(error) ( x )
k1 k2 k3
SS(total) SS(factor)
variation within rows
Calculations:
SS(total)
2
2
x
616
.
5
20316.69
(x2 )
n
20316.69 20003.80 312.89
19
x
SS(factor)
n
k1 k 2 k3
C12
C22
C32
2
208.4 2 170.9 2 237.2 2 (616.5) 2
5
8
19
6
20112.77 20003.8 108.97
SS(error) SS(total) SS(factor)
312.89 108.97 203.92
An ANOVA table is often used to record the sums of squares
and to organize the rest of the calculations.
Format for the ANOVA Table:
Source
df
SS
Factor
108.97
Error
203.92
Total
312.89
MS
Degrees of freedom, df, associated with each of the three
sources of variation:
1. df(factor): one less than the number of levels (columns), c,
for which the factor is tested.
df(factor) = c 1
2. df(total): one less than the total number of observations, n.
df(total) = n 1
n = k1 + k2 + k3 + ...
3. df(error): sum of the degrees of freedom for all levels
tested. Each column has ki 1 degrees of freedom.
df(error) = (k1 1) + (k2 1) + (k3 1) + ...
=nc
Calculations:
df(factor) = df(applicator) = c 1 = 3 1 = 2
df(total) = n 1 = 19 1 = 18
df(error) = n c = 19 3 = 16
Note:
The sums of squares and the degrees of freedom must check.
SS(factor) + SS(error) = SS(total)
df(factor) + df(error) = df(total)
Mean Square:
The mean square for the factor being tested and for the error
is obtained by dividing the sum-of-square value by the
corresponding number of degrees of freedom.
SS(factor)
MS(factor)
df(factor)
MS(error)
Calculations:
MS(factor)
SS(factor) 108.97
54.49
df(factor)
2
SS(error) 203.92
MS(error)
12.75
df(error)
16
SS(error)
df(error)
The Complete ANOVA Table:
Source
df
SS
MS
Factor
2
108.97
54.59
Error
16
203.92
12.75
Total
18
312.89
The Test Statistic:
MS(factor) 54.49
F*
4.27
MS(error) 12.75
Numerator degrees of freedom = df(factor)
Denominator degrees of freedom = df(error)
4. The Probability Distribution (Classical Approach):
a. Critical value: F(2, 16, 0.05) = 3.63
b. F* is in the critical region.
4. The Probability Distribution (p-Value Approach):
a. The p-value:
Table 9: 0.025 < P < 0.05; By computer: P = 0.033
b. The p-value is smaller than the level of significance, a.
5. The Results:
a. Decision: Reject H0.
b. Conclusion: There is evidence to suggest the three
population means are not all the same. The type of
applicator has a significant effect on the paint drying
time.
12.2: The Logic Behind ANOVA
• Many experiments are conducted to
determine the effect that different levels of
some test factor have on a response
variable.
• Single-factor ANOVA: obtain independent
random samples at each of several levels of
the factor being tested.
• Draw a conclusion concerning the effect
that the levels of the test factors have on the
response variable.
The Logic of the Analysis of Variance Technique:
1. In order to compare the means of the levels of the test
factor, a measure of the variation between the levels
(columns), the MS(factor), is compared to a measure of the
variation within the levels, MS(error).
2. If the MS(factor) is significantly larger than the MS(error),
then the means for each of the factor levels are not all the
same.
This implies the factor being tested has a significant effect
on the response variable.
3. If the MS(factor) is not significantly larger than the
MS(error), we cannot reject the null hypothesis that all
means are equal.
Example: Do the box-and-whisker plots below show
sufficient evidence to indicate a difference in the three
population means?
Level 3
Level 2
Level 1
20
25
30
Time
35
40
Solution:
1. The box-and-whisker plots show the relationship among
the three samples.
2. The plots suggest the three sample means are different
from each other.
3. This suggests the population means are different.
4. There is relatively little within-sample variation, but a
relatively large amount of between-sample variation.
Example: Do the box-and-whisker plots below show
sufficient evidence to indicate a difference in the three
population means?
Level 4
Level 3
Level 2
Level 1
60
80
100
Speed
120
140
Solution:
1. The box-and-whisker plots show the relationship among
the four samples.
2. The plots suggest the four sample means are not different
from each other.
3. There is relatively little between-sample variation, but a
relatively large amount of within-sample variation.
The data values within each sample cover a relatively wide
range of values.
Assumptions:
1. Goal: to investigate the effect of various levels of a factor on
a response variable.
a. We would like to know which level is most advantageous.
b. Probably want to reject H0 in favor of Ha.
c. A follow-up study might determine the “best” level of the
factor.
2. a. The effects due to chance and due to untested factors are
normally distributed.
b. The variance is constant throughout the experiment.
3. a. All observations are independent.
b. The data is gathered (or tests are conducted) in a
randomized order to ensure independence.
12.3: Applications of SingleFactor ANOVA
• Consider the notation used in ANOVA.
• Each observation has two subscripts: first
indicates the column number (test factor
level); second identifies the replicate (row)
number.
• The column totals: Ci
• The grand total (sum of all x’s): T
Notation used in ANOVA:
Factor Levels
Sample from
Sample from
Sample from
Replication
Level 1
Level 2
Level 3
k =1
k =2
k =3
x 1,1
x 1,2
x 1,3
x 2,1
x 2,2
x 2,3
x 3,1
x 3,2
x 3,3
Column
Totals
Sample from
Level C
x c ,1
x c ,2
x c ,3
C1
C2
C3
Cc
T = grand total = sum of all x 's = x = C i
T
Mathematical Model for Single-Factor ANOVA:
xc,k m Fc e k (c )
1. m: mean value for all the data without respect to the test
factor.
2. Fc: effect of factor (level) c on the response variable.
3. ek(c): experiment error that occurs among the k replicates in
each of the c columns.
Example: A study was conducted to determine the
effectiveness of various drugs on post-operative pain. The
purpose of the experiment was to decide if there is any
difference in length of pain relief due to drug. Eighty patients
with similar operations were selected at random and split into
four groups. Each patient was given one of four drugs and
checked regularly. The length of pain relief (in hours) was
recorded for each patient. At the 0.05 level of significance, is
there any evidence to reject the claim that the four drugs are
equally effective?
Note:
1. The data is omitted here.
2. The ANOVA table is given in a later slide.
Solution:
1. The Set-up:
a. Population parameter of interest: The mean time of pain
relief for each factor (drug).
b. The null and alternative hypothesis:
H0: m1 = m2 = m3 = m4
Ha: the means are not all equal.
2. The Hypothesis Test Criteria:
a. Assumptions: The patients were randomly assigned to
drug and their times are independent of each other. The
effects due to chance and untested factors are assumed
to be normally distributed.
b. Test statistic: F* with df(numerator) = df(factor) = 3 and
df(denominator) = df(error) = 80 4 = 76
c. Level of significance: a = 0.05
3. The Sample Evidence:
a. Sample information: The ANOVA table:
Source
df
SS
MS
Factor
3
70.84
23.61
Error
76
226.05
2.97
Total
79
296.89
b. Calculate the value of the test statistic:
MS(factor) 23.61
F*
7.95
MS(error)
2.97
4. The Probability Distribution (Classical Approach):
a. Critical value: F(3, 76, 0.05) @ 2.72
b. F* is in the critical region.
4. The Probability Distribution (p-Value Approach):
a. The p-value:
P = P(F* > 7.95, with dfn = 3, dfd = 76) < 0.01
By computer: P @ .0001
b. The p-value is smaller than the level of significance, a.
5. The Results:
a. Decision: Reject H0.
b. Conclusion: There is evidence to suggest that not all
drugs have the same effect on length of pain relief.