Unformatted text preview: Chapter 12
Multisample inference:
Analysis of Variance
Analysis EPI809/Spring 2008
EPI809/Spring 1 Learning Objectives
1.Describe Analysis of Variance (ANOVA)
2.Explain the Rationale of ANOVA
3.Compare Experimental Designs
4.Test the Equality of 2 or More Means Completely Randomized Design
Randomized Block Design
Factorial Design
EPI809/Spring 2008
EPI809/Spring 2 Analysis of Variance
A analysis of variance is a technique that
partitions the total sum of squares of
deviations of the observations about their
mean into portions associated with
independent variables in the experiment
experiment
and a portion associated with error
and
EPI809/Spring 2008
EPI809/Spring 3 Analysis of Variance
The ANOVA table was previously
The
discussed in the context of regression
models with quantitative independent
variables, in this chapter the focus will be
on nominal independent variables (factors)
on EPI809/Spring 2008
EPI809/Spring 4 Analysis of Variance
A factor refers to a categorical
factor
quantity under examination in an
experiment as a possible cause of
variation in the response variable.
variation EPI809/Spring 2008
EPI809/Spring 5 Analysis of Variance
Levels refer to the categories,
measurements, or strata of a factor of
interest in the experiment.
interest EPI809/Spring 2008
EPI809/Spring 6 Types of Experimental Designs
Experimental
Designs
Completely
Randomized Randomized
Block OneWay
Anova Factorial TwoWay
Anova EPI809/Spring 2008
EPI809/Spring 7 Completely Randomized
Completely
Design
Design EPI809/Spring 2008
EPI809/Spring 8 Completely Randomized Design
1. Experimental Units (Subjects) Are
Assigned Randomly to Treatments
Assigned Subjects are Assumed Homogeneous 2. One Factor or Independent Variable 2 or More Treatment Levels or groups 3. Analyzed by OneWay ANOVA
EPI809/Spring 2008
EPI809/Spring 9 OneWay ANOVA FTest
1. Tests the Equality of 2 or More (p)
Population Means
Population 1. Variables One Nominal Independent Variable
One Continuous Dependent Variable EPI809/Spring 2008
EPI809/Spring 10 OneWay ANOVA FTest
OneWay
Assumptions
Assumptions
1. Randomness & Independence of Errors
2. Normality Populations (for each condition) are
Populations
Normally Distributed
Normally 3.Homogeneity of Variance Populations (for each condition) have Equal
Populations
Variances
Variances
EPI809/Spring 2008
EPI809/Spring 11 OneWay ANOVA FTest
OneWay
Hypotheses
Hypotheses
H0: µ 1 = µ 2 = µ 3 = ... =
µp All Population Means
All
are Equal
are
No Treatment Effect Ha: Not All µ j Are Equal
Not At Least 1 Pop. Mean
At
is Different
is
Treatment Effect
Ν Ο Τ µ 1 ≠ µ 2 ≠ .EPI809/Spring 2008
.. ≠
EPI809/Spring 12 OneWay ANOVA FTest
OneWay
Hypotheses
Hypotheses
H0: µ 1 = µ 2 = µ 3 = ... = µ p All Population Means
All
are Equal
are
No Treatment Effect f(X) µ1 = µ2 = µ3 Ha: Not All µ j Are Equal
Not At Least 1 Pop. Mean is
At
Different
Different
Treatment Effect
Ν Ο Τ µ 1 = µ 2 = ... = µ p
Or µ i ≠ µ j for some i, j. X f(X) EPI809/Spring 2008
EPI809/Spring µ1 = µ2 µ3 X
13 OneWay ANOVA
Basic Idea
Basic
1. Compares 2 Types of Variation to Test
Equality of Means
Equality
2. If Treatment Variation Is Significantly
2.
Greater Than Random Variation then
Means Are Not Equal
Not
3.Variation Measures Are Obtained by
3.Variation
‘Partitioning’ Total Variation
‘Partitioning’
EPI809/Spring 2008
EPI809/Spring 14 OneWay ANOVA
Partitions Total Variation
Partitions EPI809/Spring 2008
EPI809/Spring 15 OneWay ANOVA
Partitions Total Variation
Partitions
Total variation EPI809/Spring 2008
EPI809/Spring 16 OneWay ANOVA
Partitions Total Variation
Partitions
Total variation Variation due to
treatment EPI809/Spring 2008
EPI809/Spring 17 OneWay ANOVA
Partitions Total Variation
Partitions
Total variation Variation due to
treatment Variation due to
random sampling EPI809/Spring 2008
EPI809/Spring 18 OneWay ANOVA
Partitions Total Variation
Partitions
Total variation Variation due to
treatment Variation due to
random sampling Sum of Squares Among
Sum of Squares Between
Sum of Squares Treatment
Among Groups Variation
EPI809/Spring 2008
EPI809/Spring 19 OneWay ANOVA
Partitions Total Variation
Partitions
Total variation Variation due to
treatment Variation due to
random sampling Sum of Squares Among
Sum of Squares Between
Sum of Squares Treatment
Sum
(SST)
(SST)
Among Groups Variation Sum of Squares Within
Sum of Squares Error
Sum
(SSE)
(SSE)
Within Groups Variation EPI809/Spring 2008
EPI809/Spring 20 Total Variation
SS ( Total ) = (Y11 − Y ) + (Y21 − Y ) + + (Yij − Y )
2 2 2 Response, Y Y Group 1 Group 2
EPI809/Spring 2008
EPI809/Spring Group 3
21 Treatment Variation
SST = n1 (Y1 − Y ) + n2 (Y2 − Y ) + + n p (Y p − Y )
2 2 2 Response, Y Y3
Y
Y1
Group 1 Y2
Group 2 EPI809/Spring 2008
EPI809/Spring Group 3
22 Random (Error) Variation
SSE = ( Y11 − Y1 ) + ( Y21 − Y1 ) + + (Y pj − Y p )
2 2 2 Response, Y Y3
Y1
Group 1 Y2 Group 2
EPI809/Spring 2008
EPI809/Spring Group 3
23 OneWay ANOVA FTest
OneWay
Test Statistic
Test 1. Test Statistic
F = MST / MSE
MST MSE STT / ( p − 1)
=
SSE / ( n − p ) • MST Is Mean Square for Treatment
• MSE Is Mean Square for Error 2. Degrees of Freedom ν 1 = p 1
ν =np
2 • p = # Populations, Groups, or Levels
• n = Total Sample Size
EPI809/Spring 2008
EPI809/Spring 24 OneWay ANOVA
OneWay
Summary Table
Summary
Source of Degrees Sum of
Variation
of
Squares
Freedom
Treatment
p1
SST Mean
F
Square
(Variance)
MST =
MST
SST/(p  1) MSE Error np SSE MSE =
SSE/(n  p) Total n1 SS(Total) =
SST+SSE
EPI809/Spring 2008
EPI809/Spring 25 OneWay ANOVA FTest
OneWay
Critical Value
Critical
If means are equal,
If
F = MST / MSE ≈ 1.
MST MSE
Only reject large F! Reject H0
Do Not
Reject H0
0 α Fa ( p −1, n −p) F Always OneTail!
© 19841994 T/Maker Co. EPI809/Spring 2008
EPI809/Spring 26 OneWay ANOVA FTest
OneWay
Example
Example
As a vet epidemiologist you
As
want to see if 3 food
supplements have different
mean milk yields. You
assign 15 cows, 5 per food
supplement.
Question: At the .05 level, is
.05
there a difference in mean
mean
yields?
yields? Food1 Food2
25.40 23.40
26.31 21.80
24.10 23.50
23.74 22.75
25.10 21.60 EPI809/Spring 2008
EPI809/Spring Food3
20.00
22.20
19.75
20.60
20.40 27 OneWay ANOVA FTest
OneWay
Solution
Solution H0: µ 1 = µ 2 = µ 3 Ha: Not All Equal
Not
α = .05
.05
ν 1 = 2 ν 2 = 12
Critical Value(s): Test Statistic:
Test MST 23.5820
F=
=
= 25.6
MSE
.9211 α = .05
.05 0 3.89 F Decision:
Decision:
Reject at α = .05
Reject
Conclusion:
There Is Evidence Pop.
There
Means Are Different
Means EPI809/Spring 2008
EPI809/Spring 28 Summary Table
Solution
Source of Degrees of Sum of
Variation Freedom Squares
Food 31=2 Mean
F
Square
(Variance)
47.1640 23.5820 25.60 Error 15  3 = 12 11.0532 Total 15  1 = 14 58.2172 EPI809/Spring 2008
EPI809/Spring .9211 29 SAS CODES FOR ANOVA Data Anova;
input group$ milk @@;
cards;
food1 25.40
food2 23.40
food1 26.31
food2 21.80
food1 24.10
food2 23.50
food1 23.74
food2 22.75
food1 25.10
food2 21.60
;
run; food3 20.00
food3
food3 22.20
food3 19.75
food3 20.60
food3 20.40 proc anova; /* or PROC GLM */
anova /*
class group;
model milk=group;
run;
EPI809/Spring 2008
EPI809/Spring 30 SAS OUTPUT  ANOVA
Source DF Model 2
12 Sum of
Squares Error
Corrected Total Mean Square F Value Pr > F 47.16400000 23.58200000 25.60 <.0001 11.05320000 0.92110000 14 58.21720000 EPI809/Spring 2008
EPI809/Spring 31 Pairwise comparisons Needed when the overall F test is rejected
Needed Can be done without adjustment of type I error if
Can
other comparisons were planned in advance
(least significant difference  LSD method)
(least Type I error needs to be adjusted if other
Type
comparisons were not planned in advance
(Bonferroni’s and scheffe’s methods)
EPI809/Spring 2008
EPI809/Spring 32 Fisher’s Least Significant
Fisher’s
Difference (LSD) Test
Difference
To compare level 1 and level 2
To
t = ( y1 − y2 ) 1 1
MSE + n n 1
2 Compare this to tα/2 = Uppertailed value or  tα//2
Compare
2
lowertailed from Student’s tdistribution for α/2 and
lower
/2
(n  p) degrees of freedom
(n
MSE = Mean square within from ANOVA table
MSE
n = Number of subjects
p = Number of levels
Number
EPI809/Spring 2008
EPI809/Spring 33 Bonferroni’s method
To compare level 1 and level 2
t = ( y1 − y2 ) 1 1
MSE + n n 1
2 Adjust the significance level α by taking
the new significance level α* p
α =α / 2
* EPI809/Spring 2008
EPI809/Spring 34 SAS CODES FOR multiple
SAS
comparisons
comparisons proc anova;
class group;
class
model milk=group;
means group/ lsd bon;
run;
EPI809/Spring 2008
EPI809/Spring 35 SAS OUTPUT  LSD
t Tests (LSD) for milk
NOTE: This test controls the Type I comparisonwise error rate,
not the experimentwise error rate.
Alpha
Error Degrees of Freedom
Error Mean Square 0.05
12
0.9211 .975,12 Critical Value of t
2.17881 = t
Least Significant Difference 1.3225
Means with the same letter are not significantly different.
t Grouping
A
B
C Mean N group 24.9300
5 food1
22.6100
5 food2
20.5900
EPI809/Spring 5 food3
EPI809/Spring 2008 36 SAS OUTPUT  Bonferroni
Bonferroni (Dunn) t Tests for milk
NOTE: This test controls the Type I experimentwise error rate
Alpha
Error Degrees of Freedom
Error Mean Square
Critical Value of t EPI809/Spring 2008
EPI809/Spring 0.05
12
0.9211
2.77947=t 37 Randomized Block
Design EPI809/Spring 2008
EPI809/Spring 38 Randomized Block Design
1.Experimental Units (Subjects) Are Assigned
Experimental
Randomly within Blocks
Randomly Blocks are Assumed Homogeneous 2.One Factor or Independent Variable of
One
Interest
Interest 2 or More Treatment Levels or Classifications 3. One Blocking Factor
EPI809/Spring 2008
EPI809/Spring 39 Randomized Block Design
Factor Levels:
(Treatments)
Experimental Units
Block 1
Block 2
Block 3
.
.
. Block b A, B, C, D
Treatments are randomly
assigned within blocks
A
C
B C
D
A D
B
D B
A
C .
.
. .
.
. .
.
. .
.
. D C A B EPI809/Spring 2008
EPI809/Spring 40 Randomized Block FTest
1.Tests the Equality of 2 or More (p)
Population Means
Population
2.Variables One Nominal Independent Variable
One Nominal Blocking Variable
One Continuous Dependent Variable EPI809/Spring 2008
EPI809/Spring 41 Randomized Block FTest
Randomized
Assumptions
Assumptions
1.Normality Probability Distribution of each BlockTreatment combination is Normal 2.Homogeneity of Variance Probability Distributions of all BlockTreatment combinations have Equal
Treatment
Variances
Variances
EPI809/Spring 2008
EPI809/Spring 42 Randomized Block FTest
Randomized
Hypotheses
Hypotheses H0: µ 1 = µ 2 = µ 3 = ... = µ p All Population Means are
All
Equal
Equal
No Treatment Effect Ha: Not All µ j Are Equal
Not At Least 1 Pop. Mean is
At
Different
Different
Treatment Effect
µ 1 ≠ µ 2 ≠ ... ≠ µ p Is
wrong
wrong EPI809/Spring 2008
EPI809/Spring 43 Randomized Block FTest
Randomized
Hypotheses
Hypotheses
H0: µ 1 = µ 2 = ... = µ p All Population
All
Means are Equal
Means
No Treatment Effect Ha: Not All µ j Are
Not
Equal
Equal f(X) µ1 = µ2 = µ3 X f(X) At Least 1 Pop.
At
Mean is Different
Mean
Treatment Effect
µ 1 ≠ µ 2 ≠ ... ≠ µ p Is
EPI809/Spring 2008
EPI809/Spring
wrong
wrong µ1 = µ2 µ3 X
44 The F Ratio for Randomized
Block Designs
Block SS=SSE+SSB+SST SST / ( p − 1)
MST
F=
=
MSE SSE / ( n − 1 − p + 1 − b + 1)
= SST / ( p − 1) SSE / ( n − p − b + 1) Randomized Block FTest
Randomized
Test Statistic
Test 1. Test Statistic
F = MST / MSE
MST MSE
• MST Is Mean Square for Treatment
• MSE Is Mean Square for Error 2. Degrees of Freedom ν 1 = p 1 ν 2 = n – b – p +1
+1
• p = # Treatments, b = # Blocks, n = Total Sample
Size
Size
EPI809/Spring 2008
EPI809/Spring 46 Randomized Block FTest
Randomized
Critical Value
Critical
If means are equal,
If
F = MST / MSE ≈ 1.
MST MSE
Only reject large F! Reject H0
Do Not
Reject H0
0 α Fa ( p −1, n −p) F Always OneTail!
© 19841994 T/Maker Co. EPI809/Spring 2008
EPI809/Spring 47 Randomized Block FTest
Randomized
Example
Example You wish to determine which of four brands of tires has
You
the longest tread life. You randomly assign one of each
brand (A, B, C, and D) to a tire location on each of 5
cars. At the .05 level, is there a difference in mean
.05
mean
tread life?
tread
Tire Location
Block Left Front Right Front Left Rear Right Rear Car 1 A: 42,000 C: 58,000 B: 38,000 D: 44,000 Car 2 B: 40,000 D: 48,000 A: 39,000 C: 50,000 Car 3 C: 48,000 D: 39,000 B: 36,000 A: 39,000 Car 4 A: 41,000 B: 38,000 D: 42,000 C: 43,000 Car 5 D: 51,000 A: 44,000 C: 52,000 B: 35,000 EPI809/Spring 2008
EPI809/Spring 48 Randomized Block FTest
Randomized
Solution
Solution H0: µ 1 = µ 2 = µ 3= µ 4 Ha: Not All Equal
Not
α = .05
.05
ν 1 = 3 ν 2 = 12
Critical Value(s): F = 11.9933
Decision:
Decision:
Reject at α = .05
Reject α = .05
.05 0 3.49 Test Statistic:
Test Conclusion:
There Is Evidence Pop.
There
Means Are Different
Means F
EPI809/Spring 2008
EPI809/Spring 49 SAS CODES FOR ANOVA
data block;
input Block$ trt$ resp @@;
cards;
Car1
A: 42000 Car1 C: 58000 Car1
Car2
B: 40000 Car2 D: 48000 Car2
Car3
C: 48000 Car3 D: 39000 Car3
Car4
A: 41000 Car4 B: 38000 Car4
Car5
D: 51000 Car5 A: 44000 Car5
;
run; B: 38000 Car1 D: 44000
A: 39000 Car2 C: 50000
B: 36000 Car3 A: 39000
D: 42000 Car4 C: 43000
C: 52000 Car5 B: 35000 proc anova;
anova
class trt block;
model resp=trt block;
Means trt /lsd bon;
Means
run;
run EPI809/Spring 2008
EPI809/Spring 50 SAS OUTPUT  ANOVA
Dependent Variable: resp Source DF Model
Error
Corrected Total 7
12
19 RSquare
0.784033
Source
trt
Block Sum of
Squares Mean Square 544550000.0
150000000.0
694550000.0 Coeff Var
8.155788 77792857.1
12500000.0 Root MSE
3535.534 F Value
6.22 Pr > F
0.0030 resp Mean
43350.00 DF Anova SS Mean Square F Value Pr > F 3
4 449750000.0
94800000.0 149916666.7
23700000.0 11.99
1.90 0.0006
0.1759 EPI809/Spring 2008
EPI809/Spring 51 SAS OUTPUT  LSD
Means with the same letter are not significantly different.
t Grouping Mean N trt A 50200 5 C: B
B
CB
C
C 44800 5 D: 41000 5 A: 37400 5 B: EPI809/Spring 2008
EPI809/Spring 52 SAS OUTPUT  Bonferroni
Means with the same letter are not significantly different.
Bon Grouping Mean N trt A
A
A 50200 5 C: 44800 5 D: C
C
C 41000 5 A: 37400 5 B: B
B
B EPI809/Spring 2008
EPI809/Spring 53 Factorial Experiments EPI809/Spring 2008
EPI809/Spring 54 Factorial Design 1. Experimental Units (Subjects) Are
Experimental
Assigned Randomly to Treatments
Assigned Subjects are Assumed Homogeneous 2. Two or More Factors or Independent
Two
Factors
Variables
Variables 3. Each Has 2 or More Treatments (Levels) Analyzed by TwoWay ANOVA
EPI809/Spring 2008
EPI809/Spring 55 Advantages
Advantages
of Factorial Designs
of
1.Saves Time & Effort e.g., Could Use Separate Completely
e.g.,
Randomized Designs for Each Variable
Randomized 2.Controls Confounding Effects by Putting
Controls
Other Variables into Model
Other
3.Can Explore Interaction Between Variables EPI809/Spring 2008
EPI809/Spring 56 TwoWay ANOVA
1. Tests the Equality of 2 or More
Tests
Population Means When Several
Independent Variables Are Used
Independent 1. Same Results as Separate OneWay
Same
ANOVA on Each Variable
ANOVA
 But Interaction Can Be Tested
EPI809/Spring 2008
EPI809/Spring 57 TwoWay ANOVA
TwoWay
Assumptions
Assumptions
1.Normality Populations are Normally Distributed 2.Homogeneity of Variance Populations have Equal Variances 3.Independence of Errors Independent Random Samples are Drawn EPI809/Spring 2008
EPI809/Spring 58 TwoWay ANOVA
TwoWay
Data Table
Data
Factor
A
1
Y111
1
Y112
Y211
2
Y212
:
:
Ya11
a
Ya12 Factor B
2
...
Y121 ...
Y122 ...
Y221 ...
Y222 ...
:
:
Ya21 ...
Ya22 ...
EPI809/Spring 2008
EPI809/Spring b
Y1b1
Y1b2
Y2b1
YX
2b2
2b2
:
Yab1
Yab2 Observation k Yi j
Level i Level j
Level
Level
Factor Factor
kB
A 59 TwoWay ANOVA
TwoWay
Null Hypotheses
Null
1.No Difference in Means Due to Factor A H0: µ 1. = µ 2. =... = µ a. 2.No Difference in Means Due to Factor B H0: µ .1 = µ .2 =... = µ .b 3.No Interaction of Factors A & B H0: ABij = 0 EPI809/Spring 2008
EPI809/Spring 60 TwoWay ANOVA
TwoWay
Total Variation Partitioning
Total Variation
SS(Total)
Variation Due to
Treatment A
Treatment Variation Due to
Variation
Treatment B
Treatment SSA SSB Variation Due to
Variation
Interaction
Interaction Variation Due to
Variation
Random Sampling
Random SS(AB) EPI809/Spring 2008
EPI809/Spring SSE
61 TwoWay ANOVA
TwoWay
Summary Table
Summary
Source of Degrees of Sum of
Variation
Freedom Squares Mean
Square F A
(Row) a1 SS(A) MS(A) MS(A)
MSE B
(Column) b1 SS(B) MS(B) MS(B)
MSE AB
(a1)(b1)
(Interaction) SS(AB) Error n  ab SSE Total n1 SS(Total) EPI809/Spring 2008
EPI809/Spring MS(AB) MS(AB)
MSE
MSE
Same as
Same
Other
Designs
Designs 62 Interaction
1.Occurs When Effects of One Factor
Occurs
Vary According to Levels of Other
Factor
Factor
2.When Significant, Interpretation of Main
When
Effects (A & B) Is Complicated
Effects
3.Can Be Detected In Data Table, Pattern of Cell Means in One
In
Row Differs From Another Row
Row
In Graph of Cell Means, Lines Cross
EPI809/Spring 2008
63
EPI809/Spring Graphs of Interaction
Effects of Gender (male or female) & dietary
Effects
group (sv, lv, nor) on systolic blood pressure
group (sv,
Interaction Average
Response No Interaction male Average
Response male female
sv lv nor
EPI809/Spring 2008
EPI809/Spring female
sv lv nor
64 TwoWay ANOVA FTest
TwoWay
Example
Example
Effect of diet (svstrict vegetarians, lvllactovegetarians, nornormal) and gender (female,
actovegetarians,
male) on systolic blood pressure.
Question: Test for interaction and main effects at
the .05 level.
.05 EPI809/Spring 2008
EPI809/Spring 65 SAS CODES FOR ANOVA
data factorial;
input dietary$ sex$ sbp;
cards;
sv male 109.9
sv
sv male 101.9
sv male 100.9
sv male 119.9
sv male 104.9
sv male 189.9
sv female 102.6
sv female 99
sv female 83 .6
sv female 99.6
sv female 102.6
sv female 112.6 lv male 116.5
lv male 118.5
lv male 119.5
lv male 110.5
lv male 115.5
lv male 105.2
nor male 128.3
nor male 129.3
nor male 126.3
nor male 127.3
nor male 126.3
nor male 125.3
nor female 119.1
nor female 119.2
nor female 115.6
nor female 119.9
nor female 119.8
nor female 119.7
;
run;
EPI809/Spring 2008
EPI809/Spring 66 SAS CODES FOR ANOVA
proc glm;
glm
class dietary sex;
model sbp=dietary sex dietary*sex;
run;
proc glm;
glm
class dietary sex;
model sbp=dietary sex;
run;
EPI809/Spring 2008
EPI809/Spring 67 SAS OUTPUT  ANOVA
Dependent Variable: sbp Source
Model
Error
Corrected Total
RSquare
0.289916 Sum of
DF
Squares Mean Square
5 2627.399667
525.479933
24 6435.215000
268.133958
29 9062.614667
Coeff Var
14.08140 Root MSE
16.37480 Source
dietary
sex
dietary*sex DF
Type I SS
2
958.870500
1 1400.686992
2
267.842175 Source
dietary
sex
dietary*sex DF
2
1
2 F Value Pr > F
1.96 0.1215 sbp Mean
116.2867 Mean Square
479.435250
1400.686992
133.921087 Type III SS Mean Square
1039.020874
519.510437
877.982292
877.982292
267.842175
133.921087
EPI809/Spring 2008
EPI809/Spring F Value Pr > F
1.79 0.1889
5.22 0.0314
0.50 0.6130
F Value Pr > F
1.94 0.1659
3.27 0.0829
0.50 0.6130
68 Linear Contrast Linear Contrast is a linear combination of the
Linear
means of populations Purpose: to test relationship among different group
Purpose:
means
means L = ∑cjµ j with ∑c j =0 Example: 4 populations on treatments T1, T2, T3 and T4.
Contrast T1
T2
T3
T4
relation to test
L1
L2 1
1 0
1/2 1
1/2 0
0 EPI809/Spring 2008
EPI809/Spring μ1  μ3 = 0
μ1 – μ2/2 – μ3/2 = 0
69 Ttest for Linear Contrast (LSD) Construct a t statistic involving k group means.
Construct
Degrees of freedom of t  test: df = nk.
test:
nk.
k To test H0: L = ∑ c j µ j = 0 Construct L t= j =1 s 2 k c 2
j ∑n
j =1 j Compare with critical value t1α/2,, nk.
Reject H0 if t ≥ t1α/2,, nk.
SAS uses contrast statement and performs an F – test df (1, nk);
Or estimate statement and perform a ttest df (nk).
EPI809/Spring 2008
EPI809/Spring 70 Ttest for Linear Contrast (Scheffe) Construct multiple contrasts involving k group
Construct
means. Trying to search for significant contrast
means.
k To test H0: L = ∑ c j µ j = 0 Construct
j =1 Compare with critical value. L t=
s 2 k c 2
j ∑n
j =1 j a = (k − 1) Fk −1,n − k ,1−α
Reject H0 if t ≥ a EPI809/Spring 2008
EPI809/Spring 71 SAS Code for contrast testing pr oc gl m
;
cl ass t r t bl
m
odel r esp=t
M
eans t r t / l
cont r ast ' A
cont r ast ' A
cont r ast ' A
cont r ast ' A
l sm
eans t r t /
l sm
eans t r t /
l sm
eans t r t /
*/
est i m e ‘ A
at r un; ock;
r t bl ock ;
sd bon s c hef
 B = 0' t r t
 B/ 2  C/ 2
 B/ 3  C/ 3
+B C D
st der r pdi f f
st der r pdi f f
st der r pdi f f
 B' f e;
1 1 0 0 ;
= 0' t r t 1  .
 D/ 3 = 0' t r t
= 0' t r t 1 1
;
adj us t =s c hef
adj us t =bon; 5 .5 0 ;
3 1 1 1 ;
1 1 ;
f e; / * Sc hef f e' s t es t
*/
/ * Bonef er oni ' s t es t t r t 1  1 0 0 0; EPI809/Spring 2008
EPI809/Spring 72 Regression representation of Anova
Regression EPI809/Spring 2008
EPI809/Spring 73 Regression representation of
Regression
Anova
yij = µ i + eij = µ + α i + eij Oneway anova:
Oneway p ∑α
i =1 i =0 Twoway anova:
Twoway
yijk = µij + eijk = µ + α i + β j + γ ij + eijk
a ∑α
i =1 b i = 0, ∑ β j = 0,
j =1 b ∑γ
j =1 ij = 0 for all i and a ∑γ
i =1 ij = 0 for all j SAS uses a different constraint
EPI809/Spring 2008
EPI809/Spring 74 Regression representation of
Regression
Anova Oneway anova: Dummy variables of factor
Oneway
with p levels
with y = β 0 + β1 x1 + β 2 x2 + ... + β p −1 x p −1 + e
1
where xi = 0 if level i
if otherwise This is the parameterization used by SAS
EPI809/Spring 2008
EPI809/Spring 75 Conclusion: should be able to
1. Recognize the applications that uses ANOVA
2. Understand the logic of analysis of variance.
3. Be aware of several different analysis of
variance designs and understand when to use
each one.
each
4. Perform a single factor hypothesis test using
4.
analysis of variance manually and with the aid of
SAS or any statistical software.
SAS
EPI809/Spring 2008
EPI809/Spring 76 Conclusion: should be able to
5. Conduct and interpret postanalysis of
5.
variance pairwise comparisons procedures.
variance
6. Recognize when randomized block
6.
analysis of variance is useful and be able to
perform the randomized block analysis.
perform
7. Perform two factor analysis of variance
7.
tests with replications using SAS and
interpret the output.
interpret
EPI809/Spring 2008
EPI809/Spring 77 Key Terms
BetweenSample
BetweenSample
Variation
Variation Completely
Completely
Randomized Design
Randomized ExperimentWide
ExperimentWide
Error Rate
Error Factor Levels OneWay Analysis
of Variance Total Variation Treatment WithinSample
Variation EPI809/Spring 2008
EPI809/Spring 78 ...
View
Full
Document
 Spring '11
 Montilla
 Statistics, Variance, EPI809/Spring

Click to edit the document details