Transcript Topic 14
Topic 14 – Experimental Design
Crossover
Nested Factors
Repeated Measures
1
Overview
We will conclude the course by considering
some different topics that can arise in a
multi-way ANOVA, as well as some other
miscellaneous topics.
Some of these are discussed a little bit in
Chapters 21, 23, and 24.
As there will be no HW covering this topic,
the coverage on the final exam will be limited
to identification and/or discussion of
concepts.
2
Types of Designs
Crossed Factors
Nested Factors
Repeated Measures
3
Crossover Design
Factors A and B are considered crossed if
every level of B occurs with every level of A.
Note: The two-way and three-way ANOVA that
we have discussed to this point has generally
had crossed factors (obs. in every cell).
Can investigate interactions assuming that we
have replication (multiple obs. per cell).
Basically, we have only been doing crossover
designs so far!
4
Diagrams of Crossover Design
5
Example
We want to examine three different drugs to
determine their effects on blood pressure.
We will have 12 men and 12 women on
each drug, and also have a control group as
well.
Drug and Gender are crossed factors (and
are both fixed effects as well).
6
ANOVA Table
Source
DRUG
GENDER
DRG*GNDR
Error
Total
DF
___
___
___
___
95
(fixed, 4 levels)
(fixed, 2 levels)
(fixed)
7
Nested Design
Factor B is considered to be nested within
Factor A if each level of B occurs with only
one level of Factor A.
Can arbitrarily number the levels of B
Cannot investigate interactions.
Denoted B(A) instead of B in ANOVA table.
8
Example (Nested)
We want to compare two fertilizers. We have
a field that is divided into 4 sections and each
section is randomly assigned one of the two
fertilizers (each is assigned twice). After two
weeks, three plants from each section are
dug up and the number of root tips for each
plant is obtained.
9
Example (Nested)
Fertilizer
1
Section
Plant
2
1
1
2
3
3
4
5
2
6
7
8
4
9
10 11 12
Response 18 22 17 22 28 25 17 15 14 12 15 16
Factors include
Fertilizer
Section (nested within Fertilizer) – also this is
the Experimental Unit!
Plant (nested within Section, Fertilizer) – note
that this effect will actually be the error term
since there is nothing “below” it.
10
Example (Nested)
Are the observations (plants) within a
section independent?
This is an example of subsampling (a form of
“repeated measures” that results in a nested
design).
By subsampling, we reduce the variance
associated with our experimental units (the
sections). But as we will see, it does not gain
DF for testing the fertilizer effect.
11
Degrees of Freedom
12 observations 11 total DF.
Have variability between sections and
variability within sections:
Only three DF for between sections
variability (since we have four sections)
This leaves eight DF for variability within
sections (Error term in our model)
The “between section” variation can be
divided up into two parts
1 DF for Treatment
2 DF for Section(Treatment)
12
Statistical Model
Yijk Ferti Sect j i Plantk ij
i 1, 2; j 1, 2; k 1, 2,3
grand mean
Ferti i fertilizer effect
th
Sect j ~ N 0, S2
Plantk ij ~ N 0, 2
Sect & Plant are independent
13
Nested Effects
Key Point: Nested effects are generally
considered RANDOM.
In our example, want results to apply to all sections
and all plants.
So we need to look at EMS to determine tests:
Source
fert
sect(fert)
Type III Expected Mean Square
Var(Error) + 3 Var(sect(fert)) + Q(fert)
Var(Error) + 3 Var(sect(fert))
14
Expected Mean Squares
As you can see from the EMS, the Fertilizer
effect will be tested over Sect(Fert).
Thus while sampling more plants in each section is
good in the sense that we get a “better” estimate
for each section, it does not improve the degrees
of freedom for testing whether there is a fertilizer
effect. One would need to add sections to do that.
Section effect will be tested over error.
Sampling more plants does give a more precise
estimate for the sections and more DF for this test.
15
SAS Coding
proc glm;
class fert sect;
model resp = fert sect(fert);
random sect(fert) /test;
Nested effects use parentheses in the
coding as described and are included in the
random statement.
16
Output
Source
fert
sect(fert)
Error
Total
DF
1
2
8
11
SS
154.1
55.5
45.3
254.9
MS
154.10
27.75
5.67
F Value
27.19
4.90
Pr > F
0.0008
0.0409
Source
fert
sect(fert)
Type III Expected Mean Square
Var(Error) + 3 Var(sect(fert)) + Q(fert)
Var(Error) + 3 Var(sect(fert))
17
Correct Tests
Source
DF
SS
fert
1
154.1
Error
2
55.5
Error: MS(sect(fert))
Source
DF
sect(fert)
2
Error: MS(Error) 8
MS
154.10
27.75
SS
55.5
45.3
F Value
5.55
MS
27.75
5.67
F Value
4.90
Pr > F
0.1426
Pr > F
0.0409
18
Conclusion
NO significant differences are shown
between the fertilizers. Two notes:
Failing to recognize that this is a nested design
will result in an incorrect conclusion that there is
a fertilizer effect.
We certainly can’t say from this that there is
NOT a fertilizer effect – the power for detecting
differences in fertilizer will be very low (2 DF
error for that test).
19
A More Complex Example
Eight subjects are used to try to determine
the effectiveness of two different drugs.
Four subjects receive Drug #1 first; the
other four receive Drug #2 first.
There is a washout period, and then they
receive the other drug during the second
period of the study.
20
Design Chart & Factors
Factors include
Order of Drugs
Subject (nested within order)
Period (crossed with both subject and order)
Note: Drug effect is ______________
21
Degrees of Freedom
16 observations 15 total DF.
BETWEEN: 8 subjects 7 DF associated to
variability between subjects.
1 DF associated to Order
6 DF associated to Subjects(Order)
WITHIN: 8 DF remaining to assess variability within
subjects.
1 DF associated to Period
1 DF associated to Order*Period
6 DF associated to Period*Subject(Order)
Order*Period is the DRUG effect.
Period*Subject(Order) must be considered as our
ERROR term (not enough DF to look at that
interaction).
22
Statistical Model
Yijk Ordi Subj j i Perk Trt jk k ij
grand mean
Ordi i th order effect
Perk k th period effect
Trt jk treatment effect
Subj j i ~ N 0,
2
S
k ij ~ N 0, 2
23
SAS Coding
proc glm;
class order subject period;
model response = order subject(order) period
period*order;
random subject(order) /test;
lsmeans period*order /adjust = Tukey pdiff;
contrast 'Drug Effect' period*order 1 -1 -1 1;
24
Output
Source
order
subject(order)
period
order*period
Error
Total
DF
1
6
1
1
6
15
Source
order
Type III Expected Mean Square
Var(Error) + 2 Var(subject(order))
+ Q(order,order*period)
Var(Error) + 2 Var(subject(order))
Var(Error) + Q(period,order*period)
Var(Error) + Q(order*period)
subject(order)
period
order*period
SS
18.1
436.9
1.6
1914.1
185.9
2556.6
MS
18.1
72.8
1.6
1914.1
31.0
F Value
0.58
2.35
0.05
61.79
Pr > F
0.4741
0.1611
0.8298
0.0002
25
Conclusions
There seems to be some kind of DRUG
effect (represented by the order/period
interaction).
The actual effect is not yet clear – we must set
up a contrast on the order*period interaction to
examine the drug effect.
We may also be able to consider LSMeans
We may not have been able to see this
effect as well without appropriately
accounting for the other variables.
26
LSMeans
order
period
1
1
2
2
1
2
1
2
response
LSMEAN
LSMEAN
Number
165.500000
143.000000
141.500000
162.750000
1
2
3
4
Adjustment for Multiple Comparisons: Tukey
Pr > |t| for H0: LSMean(i)=LSMean(j)
i/j
1
2
3
4
1
0.0050
0.0036
0.8940
2
0.0050
0.9795
0.0096
3
0.0036
0.9795
4
0.8940
0.0096
0.0067
0.0067
27
LSMeans / Contrast
We see some groupings that we might
expect:
(1,4) = DRUG #1
(2,3) = DRUG #2
A contrast to consider the difference in
drugs would be:
contrast 'Drug Effect' period*order 1 -1 -1 1;
Contrast
Drug Effect
DF
1
Contrast SS
1914.0625
Mean Square
1914.0625
F Value
61.79
Pr > F
0.0002
28
Repeated Measures Design
Measurements taken on the same
experimental units are by
definition not independent.
29
Repeated Measures Design
Repeated Measures – Experimental unit is
measured more than once.
Response variable measured on same subject over
time.
Several observations taken from same
experimental unit at the same time (subsampling).
If have repeated measures, then the
experimental unit is generally considered a
random factor.
Sometimes we are able to keep things simple by
applying a nested design.
In all case EMS are used to determine correct tests.
30
Previous Examples
Both of the previous examples involved
repeated measures in the sense that:
Example 1 – There were repeated measures for
the sections in the sense that we measured
multiple plants.
Example 2 – There were repeated measures on
the subjects in the sense that each subject was
observed on each drug.
In both cases, we used a nested design to
accomplish the analysis.
31
One More Example
Problem 21.4 from the textbook.
24 “thirsty” rats trained to press a lever to obtain
water.
Rats categorized into three groups of eight (slow,
medium, fast) based on their initial press rate.
Each rat received three different doses of a drug,
along with a placebo, on separate occasions, and in
a random order.
One hour later after the dose, drugs received water
after pressing a lever a pre-specified number of
times (2 or 5) – half the rats on each #.
32
Example
Primary Research Question: Does the drug
affect the LPR (lever press rate)?
Response variable is the lever press rate (total
number of presses divided by time in seconds).
Crossed factors include DRUG, # of presses (PRS),
and initial press rate (IPR).
RAT is a random effect and we have repeated
measures on the rats. RAT is nested – within the
IPR*PRS effect. (See table page 623).
33
ANOVA Table / DF
Source
IPR
PRS
IPR*PRS
Rat(IPR*PRS)
Drug
Drug*IPR
Drug*PRS
Drug*IPR*PRS
Drug*IPR*PRS*RAT
DF
2
1
2
18
3
6
3
6
54
(Fixed)
(Fixed)
(Fixed)
(Random)
(Fixed)
(Fixed)
(Fixed)
(Fixed)
(Error)
34
SAS Code
proc glm data=rats;
class IPR PRS Rat Drug;
model LPR = IPR|PRS|Drug Rat(IPR*PRS);
random Rat(IPR*PRS) /test;
35
ANOVA Table
Source
IPR
PRS
IPR*PRS
Rat(IPR*PRS)
Drug
IPR*Drug
PRS*Drug
IPR*PRS*Drug
Error
Total
DF
2
1
2
18
3
6
3
6
54
95
Sum of
Squares
3.88891458
28.87523438
0.04298125
0.81975208
13.01466979
0.15725208
6.09505312
0.21191875
0.08892292
53.19469896
Mean Square
1.94445729
28.87523438
0.02149063
0.04554178
4.33822326
0.02620868
2.03168437
0.03531979
0.00164672
F Value
1180.81
17535.0
13.05
27.66
2634.46
15.92
1233.78
21.45
P
<
<
<
<
<
<
<
<
Are any of the F tests correct?
36
Expected MS
Source
IPR
PRS
IPR*PRS
Rat(IPR*PRS)
Drug
IPR*Drug
PRS*Drug
IPR*PRS*Drug
Type III Expected Mean Square
Var(Error) + 4 Var(Rat(IPR*PRS))
+ Q(IPR,IPR*PRS,IPR*Drug,IPR*PRS*Drug)
Var(Error) + 4 Var(Rat(IPR*PRS))
+ Q(PRS,IPR*PRS,PRS*Drug,IPR*PRS*Drug)
Var(Error) + 4 Var(Rat(IPR*PRS))
+ Q(IPR*PRS,IPR*PRS*Drug)
Var(Error) + 4 Var(Rat(IPR*PRS))
Var(Error) + Q(Drug,IPR*Drug,PRS*Drug,IPR*PRS*Drug)
Var(Error) + Q(IPR*Drug,IPR*PRS*Drug)
Var(Error) + Q(PRS*Drug,IPR*PRS*Drug)
Var(Error) + Q(IPR*PRS*Drug)
F Tests from Drug on down will be correct.
Others should be tested over MS(Rat)
37
Further Analysis
PRS
2
5
With respect to “drug”, everything is fairly
straight forward.
Appears to be an important interaction with
the number of presses. So examine from
the interaction perspective.
Start with “sliced” LSMeans:
DF
3
3
SS
0.726150
17.718724
MS
0.242050
5.906241
F Value
146.99
3586.67
Pr > F
<.0001
<.0001
38
Further Analysis
PRS
2
2
2
2
Though both are significant, there appears
to be a much bigger drug effect when 5
presses are required. We can see this by
examining the LSMeans themselves:
Drug
1
2
3
4
LPR LSMEAN
1.03833333
1.05833333
1.06083333
0.76916667
PRS
5
5
5
5
Drug
1
2
3
4
LPR LSMEAN
2.57833333
2.54166667
2.14666667
1.04990741
The highest level of drug decreases the
lever press rate (rats need water more?).
39
Other questions
Is the # of presses required important?
Yes, particularly in its interaction with the Drug.
Definitely an observable main effect as well (test
over Rat, F = 634)
Is the IPR important?
Correct to test over Rat, but F = 42.7 is still quite
large. Conclusion: Yes.
Could use LSMeans, make sure to use correct
term as error (MSRat).
40
Questions?
41