Repeated Measures Example In an exercise therapy study, subjects were assigned to one of three weightlifting programs (i=1) The number of repetitions of weightlifting was increased as subjects became stronger (RI) (i=2) The amount of weight was increased as subjects became stronger (WI) (i=3) Subjects did not participate in weightlifting (XCont) 1 Measurements of strength (Y ) were taken on days 2, 4, 6, 8, 10, 12 and 14 for each subject. Source: Littel, Freund, and Spector (1991) SAS System for Linear Models R code: RepeatedMeasures.R 2 Mixed model Yijk = µ + αi + Sij + τk + γik + eijk Yijk strength measurement for prog. i, subj. j , time point k αi Sij τk γik eijk fixed program effect random subject effect fixed time effect fixed prog.×time interaction random error where the random effects are all independent and 2) Sij ∼ N ID(0, σS ijk ∼ N ID(0, σ2) 3 Average strength after 2k days on the i-th program is µik = E(Yijk ) = E(µ + αi + Sij + τk + γik + eijk ) = µ + αi + E(Sij ) + τk + γik + E(eijk ) = µ + αi + τk + γik for i = 1, 2, 3 and k = 1, 2, . . . , 7 The variance of any single observation is V ar(Yijk ) = V ar(µ + αi + Sij + τk + αik + eijk ) = V ar(Sij + eijk ) = V ar(Sij ) + V ar(eijk ) 2 + σ2 = σS e 4 Correlation between observations taken on the same subject: Cov(Yijk , Yij`) = Cov(µ + αi + Sij + τk + γik + eijk , µ + αi + Sij + τ` + γi` + eij`) = Cov(Sij + eijk , Sij + eij`) = Cov(Sij , Sij ) + Cov(Sij , eij`) +Cov(eijk , Sij ) + Cov(eijk , eij`) = V ar(Sij ) for k 6= ` 2. = σS 5 The correlation between Yijk and Yij` is 2 σS ≡ρ 2 2 σS + σe Observations taken on different subjects are uncorrelated. 6 For the set of observations taken on a single subject, we have V ar = Yij1 Yij3 .. Yij7 2 2 σe2 + σS σS ··· 2 2 ··· σS σe2 + σS .. 2 σS .. 2 σS ... 2 σS 2 σS 2 σS 2 σ2 + σ2 σS e S 2J = σe2I + σS ↑ J is a matrix of ones This covariance structure is called compound symmetry. 7 Write this model in the form Y = Xβ + Zu + e Y111 Y112 ... Y117 Y121 Y122 ... Y127 ... Y211 Y212 ... Y217 ... Y3,n31 Y3,n32 ... Y3,n37 = 1 1 0 1 1 0 ... 1 1 0 1 1 0 1 1 0 ... 1 1 0 ... 1 0 1 1 0 1 ... 1 0 1 ... 1 0 0 1 0 0 ... ... 1 0 0 0 1000000 | 0 0100000 | ... | 0 0000001 | 0 1000000 | 0 0100000 | ... | 0 0000001 | | 0 1000000 | 0 0100000 | ... | 0 0000001 | | 1 1000000 | 1 0100000 | ... | 1 0000001 | 21 columns for interaction 8 µ α1 α2 α3 τ1 τ2 τ3 τ4 τ5 τ6 τ7 γ11 γ12 ... γ37 1 1 ... 1 0 0 ... + 0 ... ... ... 0 0 ... 0 0 0 ... 0 1 1 ... 1 ... ... ... 0 0 ... 0 ··· 0 ··· 0 ... ··· 0 ··· 0 ··· 0 ... ··· 0 ... ... ... ··· 1 ··· 1 ... ··· 1 e111 e112 ... e117 e121 e122 ... S11 e127 S12 ... ... ... + e 211 ... e212 ... S3,n3 e217 ... e3,n31 e3,n32 ... e3,n37 9 In this case: R = V ar(e) = σe2I(7r)×(7r) 2I G = V ar(u) = σS r×r where r is the number of subjects Σ = V ar(Y) = ZGZ T + R is a block diagonal matrix with one block of the form 2J (σe2I7×7 + σS 7×7) for each subject 10 Mean strength at a particular time in a particular program LSM EAN = µ̂ + α̂i + τ̂k + γ̂ik = Ȳi.k = V ar(Ȳi.k ) = SȲ i.k = v u u u u u u u t 6 1 nXi ni j=1 Yijk 2 σe2 + σS ni 1 1 M Serror + M SSubj 7 7 ni ↑ Cochran-Satterthwaite degrees of freedom are 65.8 11 Program means (averaging across time) LSM EAN = Ȳi.. 1 X 7 (τ̂k + γ̂ik ) = µ̂ + α̂i + 7 k=1 V ar(Ȳi...) = SȲ i.. = 2 σe2 + 7σS 7ni v u u u u u u u t M Ssubjects 2ni There are n1 = 16, n2 = 21, n3 = 20 subjects in the three programs. 12 Mean strength at a particular time point (averaging across programs) 1 X 3 LSM EAN = µ̂ + τ̂k + (α̂i + γ̂ik ) 3 i=1 1 X 3 = (Ȳi.k ) 6= Ȳ..k 3 i=1 because n1 = 16, n2 = 21, n3 = 20. 2 2 1 X 3 σe + σS V ar(LSM EAN ) = 9 i=1 ni SLSM EAN = 1 3 v u u u u u t 6 1 3 1 X M Serror + M Ssubj 7 7 n i=1 i ↑ Cochran-Satterthwaite degrees of freedom are 65.8 13 Difference between strength means at two time points (averaging across programs) τ̂k + 13 3i=1 γ̂ik − τ̂` − 13 3i=1 γ̂i` P P 1 1 X 3 3 X Ȳi.k − Ȳi.` = 3 i=1 3 i=1 1 X 3 1 n Xi = (Yijk − Yij`) 3 i=1 ni j=1 ↑ subject effects cancel out 14 Variance formula: 2σe2 3 1 9 Σi=1 ni Standard error: v u u u u t 2M Serror Σ3 1 = 0.206 i=1 ni 9 ↑ use degrees of freedom for error = 324 15 Difference between strength means for two programs at a specific time point (µ̂ + α̂i + τ̂ik + γ̂ik ) − (µ̂ + α̂` + τ̂k + γ̂`k ) = Ȳi.k − Ȳ`.k 1 1 2 2 V ar(Ȳi.k − Ȳ`.k ) = (σe + σS )( + ) ni n` SȲ −Ȳ = i.k `.k v u u u u u t 6 1 1 1 M Serror + M Ssubj + 7 7 ni n` ↑ Use Cochran-Satterthwaite degrees of freedom = 65.8 16 Difference between strength means at two time points within a particular program (µ̂ + α̂i + τ̂k + γ̂ik ) − (µ̂ + α̂i + τ̂` + γ̂i`) = Ȳi.k − Ȳi.` V ar(Ȳi.k − Ȳi.`) = ni 2σe2 1 V ar n Σj=1(Yijk − Yij`) = n i i v u u u u t SȲ −Ȳ = M Serror n2 i.k i.` i ↑ use degrees of freedom for error=324 17 Difference in strength means for two programs (averaging across time points) 1 X 1 X 7 7 γ̂ik ) − (α̂` + γ̂`k ) Ȳi.. − Ȳ`.. = (α̂i − 7 k=1 7 k=1 V ar(Ȳi.. − Ȳ`..) = SȲ −Ȳ = i.. `.. (σe2 v u u u u u t + 2 )( 7σS 1 7ni M Ssubjects( + 1 7ni 1 7n` + ) 1 7n` ↑ 54 d.f. 18 ) Specifying other covariance matrices We began with the model Yijk = µ + αi + Sij + τk + γik + eijk where 2) Sij ∼ N ID(0, σS eijk ∼ N ID(0, σe2) and the {Sij } are distributed independently of the {eijk } 19 This model was expressed in the form Y = Xβ + Zu + e where S11 .. u= S3,20 contained the random subject effects 20 Here 2I G = V ar(u) = σS R = V ar(e) = σe2I Σ = V ar(Y) = ZGZ T + R 2 = σS = 2J σe2I + σS J J ... J + σe2I ... 2J σe2I + σS where J is a matrix of ones. 21 If you are not interested in predicting subject effects (random subject effects are included only to introduce correlation among repeated measures on the same subject), you can work with an alternative expression of the same model Y = Xβ + e∗ where R = V ar(e∗) = 2J σe2I + σS ... 2J σe2I + σS 22 Replace the mixed model Y = Xβ + Zu + e with the model Y = Xβ + e∗ where W 0 ··· 0 0 W ··· 0 ∗ V ar(Y) = V ar(e ) = ............ 0 0 ··· W 23 First Order Autoregressive: AR(1) W = σ2 1 ρ ρ2 ρ3 ρ 1 ρ ρ2 ρ2 ρ 1 ρ ρ3 ρ2 ρ 1 where σ 2 ∈ (0, ∞) and ρ ∈ (−1, 1) are unknown parameters. 24