SJS SDI_11 1
Design of Statistical Investigations
Stephen Senn
11 Nested Factors
SJS SDI_11 2
Crossed Factors
• So far the treatment and blocking factors we have considered have been “crossed”.
• In principle every level of one could be observed with every level of the other.– Every treatment in each block
• Or at least the same treatments in various blocks
– Each level of a factor in combination with each of another
SJS SDI_11 3
Nested Factors
• Sometimes some factors can only appear within other factors
• Blocks with sub-blocks– Example: Patients within given group allocated
a particular sequence• Episodes of treatment within patients
• Treatments with sub-treatments
• Such factors are “nested”
SJS SDI_11 4
Exp_15Nested “Treatments”
• Suppose that we wish to compare two beta-agonists in asthma, formoterol and salmeterol
• Formoterol has three formulations• solution, single-dose dry-powder inhaler, multi-
dose dry-powder inhaler
• Salmeterol has two• suspension, multi-dose dry powder inhaler
SJS SDI_11 5
Exp_15Treatment Structure
F orm otero lS o lu tion
F orm otero lP owd er
S in g le -d ose
F orm otero lP owd er
M u lti-d ose
F orm otero l P ow d er
F orm otero l
S a lm etero lS u sp en s ion
S a lm etero lP owd er
(m u lt i-d ose)
S a lm etero l
Trea tm en tsB eta-ag on is ts
SJS SDI_11 6
Exp_15Treatments
• From one point of view we have five treatments– defined by combination of molecule and
formulation
• We may have a hierarchy of interest– primarily to compare molecules
• then to compare formulations within molecules– possibly delivery type within formulations
SJS SDI_11 7
Exp_15
Possible factors (levels)
A: Treatments ( Formoterol, Salmeterol)
B: Formoterol formulation (Solution, Powder)
B*: Salmeterol formulation (Suspension, Powder)
C: Formoterol powder device (Single, Multi)
Note that B* is not really the same as B and each of the lower level factors only has meaning in the context of the higher level
SJS SDI_11 8
Wilkinson and Roger NotationWe encountered this in connection with factorial designs
Now we add an operator / for nested designs
A/B = A + A:B
Not that if B is a factor nested within A, it has no meaning on its own. Hence the main effect B does not exist on its own.
NB In their original papers Applied Statistics,1973,22,392-399, W&R used instead of : as used in S-PLUS
SJS SDI_11 9
Exp_13
• We encountered this example before
• We could regard this as an example of a nested design
• Treatments, placebo, ISF, MTA
• Doses within treatments
SJS SDI_11 10
Exp_13As nested design
P lacebo
6 12 24
IS F
6 12 24
M T A
F o rm u la tion
A c tiv e?
SJS SDI_11 11
Exp_13Nested Analysis
> #As before but treat as nested factorsfit2 <- aov(AUC ~ Patient + Period + Active/Formul/Dose, na.action = na.exclude)> summary(fit2, corr = F) Df Sum of Sq Mean Sq F Value Pr(F) Patient 157 80.29301 0.511420 70.5027 0.0000000 Period 4 0.02092 0.005230 0.7210 0.5777861 Active 1 1.63959 1.639591 226.0286 0.0000000 Formul %in% Active 1 0.66308 0.663078 91.4097 0.0000000Dose %in% (Active/Formul) 4 0.22666 0.056664 7.8115 0.0000038 Residuals 603 4.37411 0.007254
SJS SDI_11 12
Random Treatment Effects
• We now pick up a theme we alluded to in lecture 10
• Cases where our principle interest is in random effects– not random blocks– random treatments
• This example has nesting
SJS SDI_11 13
Exp_16Clarke and Kempson Example 13.1
1 2 3 4 5
A
1 2 3 4 5 6 7
B
1 2 3 4 5 6
C
1 2 3 4 5 6
D
Four labs, A,B,C,D. Six samples of uniform batch given to each. However a sample intended for A is sent to B by mistake
SJS SDI_11 14
Fixed or Random?
• If we are interested in the performance of these four labs, we can consider them as fixed
• However we may be interested in using them to tell us how measurements vary in general from lab to lab
• If they are a sample of such labs, we could consider the effects as random
SJS SDI_11 15
Exp_16The Data
Lab Sample Result 1 A 1 16.0 2 A 2 17.1 3 A 3 16.9 4 A 4 17.2 5 A 5 17.0 6 B 1 17.0 7 B 2 17.3 8 B 3 16.2 9 B 4 17.110 B 5 16.011 B 6 17.212 B 7 17.0
Lab Sample Result 13 C 1 16.914 C 2 16.115 C 3 16.416 C 4 16.117 C 5 16.618 C 6 16.319 D 1 15.020 D 2 15.921 D 3 16.022 D 4 15.923 D 5 16.224 D 6 15.9
SJS SDI_11 16
A
B
C
D
15.0 15.5 16.0 16.5 17.0
Result
lab
ora
tory
Data from Exp_13Data from Exp_13Data from Exp_13Data from Exp_13Data from Exp_13Data from Exp_13Data from Exp_13Data from Exp_13Data from Exp_13Data from Exp_13Data from Exp_13Data from Exp_13Data from Exp_13Data from Exp_13Data from Exp_13Data from Exp_13
SJS SDI_11 17
Model
1
2 2
.1
2 2 2 2.
22 2 2 2 2 2 2.
( 1 , 1 )
, 0, 0
,
,i
ij i ij i
v
i i iji
i ij
r
i i i i ij i ij
i i i
i i i i i i
y i v j r
r N E E
Var Var
T r r E T r
Var T r r
E T Var T E T r r r
SJS SDI_11 18
Sums of Squares & Expectations
2 2
1
2 2
1
2
2. .
1 1 1 1
2.
1 1
2.
1 1
/
( ) ( ) ( )
( )
( ) (
i i
i
i
v
between i ii
vi
betweeni i
r rv v
within ij i i ij i ii j i j
rv
within ij ii j
rv
within ij i iji j
SS T r G N
E T E GE SS
r N
SS y y
SS
E SS E E
2.
1 1
2 2
1
)
( 1) ( )
irv
ii j
v
ii
r N r
SJS SDI_11 19
1 1 1 1 1
22 2 2 2 2
1
2 2
1
2 2
2 2 2 2 21
1 1
2
2 21 ( 1)
i ir rv v v
ij i i iji j i i j
v
ii
vi
betweeni i
v
iv vi
i ii i
v
ii
G y N r
E G N
E G Var G E G r N N
E T E GE SS
r N
rr v r N
N
rN v
N
SJS SDI_11 20
ANOVAExpected value ofmean square
Source ofVariation
d.f. GeneralCase
Equalreplication
BetweenGroups
1v 2 2 2 2r
W ithinGroups
N v 2 2
Total 1N 2
1
1 1
1
v
ii
N rv N
SJS SDI_11 21
Calculations Exp_16
20
2 2 2 2
84.1; 117.8; 98.4; 94.9
395.3; 24; 395.3 / 24 6510.9204;
6518.95;
84.2 117.8 98.4 94.96515.0954
5 7 6 6
A B C D
labs
y y y y
G N S
S
S
SJS SDI_11 22
ANOVA Exp_16
Source d.f. Sum ofSquares
Meansquare
BetweenLaboratories
3 4.1750 1.3917
WithinLaboratories
20 3.8546 0.1927
Total 8.0296
SJS SDI_11 23
Exp_16Components of Variance
2 2 2 2
2 2
1 124 5 7 6 6 5.972
3 24
1ˆ ˆ0.1927, 1.3917 0.1927 0.2008
5.972
SJS SDI_11 24
Exp_16S-PLUS Analysis
> is.random(one.frame) <- T> varcomp.1 <- varcomp(Result ~ Lab, data = one.frame, method = "reml")> summary(varcomp.1)Call:varcomp(formula = Result ~ Lab, data = one.frame, method = "reml")Variance Estimates: Variance Lab 0.2000226Residuals 0.1927181Method: reml Approximate Covariance Matrix of Variance Estimates: Lab Residuals Lab 0.03612192 -0.00063555Residuals -0.00063555 0.00379463
SJS SDI_11 25
Exp_14 Revisited
> #Variance components analysisSubject.ran <- data.frame(Subject)> is.random(Subject.ran) <- T> varcomp(lAUC ~ Subject + Formulation, data = Subject.ran)Variances: Subject Residuals 0.0766226 0.003424223> varcomp(lAUC ~ Subject * Formulation, data = Subject.ran)Variances: Subject Subject:Formulation Residuals 0.07679968 -0.0005244036 0.003764744