Replicated Latin Square and Crossover Designs
Replicated Latin Square Latin Square Design small df E, low power If 3 treatments 2 df error If 4 treatments 6 df error Can use replication to increase df E, power Methods of replication Use the same row and column blocks Use new row blocks but same column blocks Use the same row blocks and new column blocks Use new row and column blocks Degrees of freedom depend on what is new /randomized Often include additional block - replicate effect Replicated Latin Squares 2
Replicate the Square Same row/column blocks used in additional squares Usually includes replicate (e.g., time) effect y ijkl = µ + α i + τ j + β k + δ l + ǫ ijkl i = 1, 2,..., p j = 1, 2,..., p k = 1, 2,..., p l = 1, 2,..., n Replicated Latin Squares 3
Source of Sum of Degrees of Mean F Variation Squares Freedom Square Rows SS Row p 1 Columns SS Column p 1 Replicate SS Replicate n 1 Treatment SS Treatment p 1 MS Treatment F 0 Error SS E (p 1)(n(p + 1) 3) MS E Total SS T np 2 1 Replicated Latin Squares 4
Replicate the Rows (or columns) Different rows (columns) in new square Row(column) effects nested within square Same column(row) effects y ijkl = µ + α i(l) + τ j + β k + δ l + ǫ ijkl i = 1, 2,..., p j = 1, 2,..., p k = 1, 2,..., p l = 1, 2,..., n Replicated Latin Squares 5
Source of Sum of Degrees of Mean F Variation Squares Freedom Square Rows SS Row n(p 1) Columns SS Column p 1 Replicate SS Replicate n 1 Treatment SS Treatment p 1 MS Treatment F 0 Error SS E (p 1)(np 2) MS E Total SS T np 2 1 Replicated Latin Squares 6
Latin Rectangle Replicate rows(columns) but not multiple squares np separate rows (n integer) y ijk = µ + α i + τ j + β k + ǫ ijk i = 1, 2,..., np j = 1, 2,..., p k = 1, 2,..., p Replicated Latin Squares 7
Source of Sum of Degrees of Mean F Variation Squares Freedom Square Rows SS Row np 1 Columns SS Column p 1 Treatment SS Treatment p 1 MS Treatment F 0 Error SS E (p 1)(np 2) MS E Total SS T np 2 1 Replicated Latin Squares 8
Replicated Rows and Columns Have completely separate squares Row and column effect nested within square y ijkl = µ + α i(l) + τ j + β k(l) + δ l + ǫ ijkl i = 1, 2,..., p j = 1, 2,..., p k = 1, 2,..., p l = 1, 2,..., n Replicated Latin Squares 9
Source of Sum of Degrees of Mean F Variation Squares Freedom Square Rows SS Row n(p 1) Columns SS Column n(p 1) Replicate SS Replicate n 1 Treatment SS Treatment p 1 MS Treatment F 0 Error SS E (p 1)(n(p 1) 1) MS E Total SS T np 2 1 Replicated Latin Squares 10
Graeco-Latin Square Design Described in Section 4.3 Superimposes two Latin Squares onto each other Allows blocking on three factors Exists for all p 3 except p 6 Degrees of freedom error is (p 3)(p 1) p = 4 df E =3 p = 5 df E =8 Replicated Latin Squares 11
Crossover Design A commonly-use within-subject design Considers s subjects as blocks Each subject undergoes p treatments run over p periods Can consider incomplete block structure (# periods < # trts) Used in drug comparisons/physiology experiments Delay between periods to remove residual effect Residual effect also called carryover effect Replicated Latin Squares 12
Crossover Design Used because one anticipates high level of variability between subjects block on subject to remove it Subject (S k ) is serving as its own control Commonly used for 2, 3, or 4 periods Period (P i ) is typically considered a blocking factor too Potential drawbacks: Subsequent use / carryover effect Replicated Latin Squares 13
Analysis of a Crossover Design Another variation of a repeated measures design Linear model approach similar to that of Latin Rectangle y ijk = µ + P i + τ j + S k + ǫ ijk Assumes no residual effects, subjects ǫ s can be correlated Consider 2 2 experiment with n subjects per group (order of treatments). Using model with ǫ N(0, sigma 2 ), the difference in trts for the two groups can be written Subjects who received Trt 1 first : diff 1k = (τ 1 τ 2 ) + (P 1 P 2 ) + (ǫ 11k ǫ 22k ) Subjects who received Trt 2 first : diff 2k = (τ 2 τ 1 ) + (P 1 P 2 ) + (ǫ 21k ǫ 12k ) Subject effects cancel out. Only within-subject variability left. Thus diff 1. diff 2. estimates 2(τ 1 τ 2 ) with standard error 4ˆσ 2 /n This result is equivalent to fitting the linear model above Replicated Latin Squares 14
Issue of Residual Effects But what if there are residual effects. This alters the overall effect in the second period. Considering r 1 and r 2 the residuals effects, the difference can be written Trt 1 first : diff 1k = (τ 1 (τ 2 + r 1 )) + (P 1 P 2 ) + (ǫ 11k ǫ 22k ) Trt 2 first : diff 2k = (τ 2 (τ 1 + r 2 )) + (P 1 P 2 ) + (ǫ 21k ǫ 12k ) Thus diff 1 diff 2 estimates 2(τ 1 τ 2 )+(r 2 r 1 ). Mean difference no longer estimates just difference in treatments (confounded with difference in residual effects). Can test for residual effect by looking at sums instead of differences. Consider subject effects random so subject variability incorporated into error (δ ijk = ǫ ijk +S k ) Trt 1 first : sum 1k = 2µ + (τ 1 + τ 2 + r 1 ) + (P 1 + P 2 ) + δ 1k Trt 2 first : sum 2k = 2µ + (τ 2 + τ 1 + r 2 ) + (P 1 + P 2 ) + δ 2k Thus sum 1 sum 2 estimates (r 1 r 2 ). Can check to see if different from zero. Unfortunately this is a low power test because it incorporates between-subject variability, which is often larger than within-subject variability. Replicated Latin Squares 15
Modeling Residual Effects Can attempt to include residual effects in model Need p > 2 if subjects considered fixed effect Not orthogonal so fit order important (Type III SS if using OLS) First-order residual effects model y ijk = µ + P i + τ j + S k + r ij + ǫ ijk i = 1, 2,..., p j = 1, 2,..., p k = 1, 2,..., np where r ij only occurs when i 1 and j references the trt used in the previous period. Replicated Latin Squares 16
Crossover Analysis when p = 2 Will analyze the following data set using Differences and sums Proc GLM - fixed effects linear model Proc Mixed - subjects considered random effects Need to create design column(s) for residual effects data trt2cross; input subj period trt resid y @@; cards; 1 1 1 0 32 1 2 2 1 35 2 1 1 0 31 2 2 2 1 36 3 1 1 0 31 3 2 2 1 35 4 1 1 0 33 4 2 2 1 37 5 1 1 0 32 5 2 2 1 35 6 1 2 0 35 6 2 1-1 33 7 1 2 0 36 7 2 1-1 30 8 1 2 0 34 8 2 1-1 32 9 1 2 0 38 9 2 1-1 35 10 1 2 0 37 10 2 1-1 37 ; Replicated Latin Squares 17
Demonstration Using SAS **Calculate differences and sums by hand and enter into data set; data trt2cross_diff; input subj order ydiff @@; cards; 1 1-3 2 1-5 3 1-4 4 1-4 5 1-3 6 2 2 7 2 6 8 2 2 9 2 3 10 2 0 ; proc ttest; var ydiff; class order; run; ***Test if trts differ data trt2cross_sum; input subj order ysum @@; cards; 1 1 67 2 1 67 3 1 66 4 1 70 5 1 67 6 2 68 7 2 66 8 2 66 9 2 73 10 2 74 ; proc ttest; var ysum; class order; run; ***Test if res effects differ Replicated Latin Squares 18
SAS Output Variable: ydiff order N Mean Std Dev Std Err Minimum Maximum 1 5-3.8000 0.8367 0.3742-5.0000-3.0000 2 5 2.6000 2.1909 0.9798 0 6.0000 Diff (1-2) -6.4000 1.6583 1.0488 Method Variances DF t Value Pr > t Pooled Equal 8-6.10 0.0003 ***Trt Satterthwaite Unequal 5.1424-6.10 0.0015 ------------------------------------------------------------------- Variable: ysum order N Mean Std Dev Std Err Minimum Maximum 1 5 67.4000 1.5166 0.6782 66.0000 70.0000 2 5 69.4000 3.8471 1.7205 66.0000 74.0000 Diff (1-2) -2.0000 2.9240 1.8493 Method Variances DF t Value Pr > t Pooled Equal 8-1.08 0.3110 ***Residual Satterthwaite Unequal 5.2139-1.08 0.3269 Replicated Latin Squares 19
Demonstration Using SAS ***Get trt*period means***; proc sort; by trt period; proc means; var y; by trt period; run; ***Fit using fixed effects linear model***; proc glm; class subj trt period; model y = subj trt period; lsmeans trt / lines; ***Try to include residual effects***; proc glm; class subj trt period; model y = resid period subj trt; lsmeans trt / lines; run; Replicated Latin Squares 20
SAS Output ***Summary of the Proc Means Output*** Trt1 Period1 31.8 Trt2 Period1 36.0 --> Trt1 32.6 Period1 33.9 Trt1 Period2 33.4 --> Trt2 35.8 Period2 34.5 Trt2 Period2 35.6 --> GrandMean 34.2 ***Using latin rectangle linear model**** Estimated treatment difference is 35.8-32.6 = 3.2 ***Using first-order residual effects model**** Period 1 Trt2 - Trt1 = 36.0-31.8 = 4.2 Period 2 Trt2 - Trt1 = 35.6-33.4 = 2.2 ** **Includes possible residuals effects **Therefore, estimated treatment difference is 4.2 **(r1 - r2) = 2*r1 = -2 --> r1 = -1 Replicated Latin Squares 21
GLM Output - No Residual Effects Sum of Source DF Squares Mean Square F Value Pr > F Model 11 92.2000000 8.3818182 6.10 0.0082 Error 8 11.0000000 1.3750000 Corrected Total 19 103.2000000 Source DF Type I SS Mean Square F Value Pr > F subj 9 39.20000000 4.35555556 3.17 0.0595 trt 1 51.20000000 51.20000000 37.24 0.0003*** period 1 1.80000000 1.80000000 1.31 0.2856 Source DF Type III SS Mean Square F Value Pr > F subj 9 39.20000000 4.35555556 3.17 0.0595 trt 1 51.20000000 51.20000000 37.24 0.0003*** period 1 1.80000000 1.80000000 1.31 0.2856 Parameter Estimate Std Error t Value Pr > t trt 1-3.20000000 B 0.52440442-6.10 0.0003*** period 1-0.60000000 B 0.52440442-1.14 0.2856 Replicated Latin Squares 22
GLM Output - Residual Effects Sum of Source DF Squares Mean Square F Value Pr > F Model 11 92.2000000 8.3818182 6.10 0.0082 Error 8 11.0000000 1.3750000 Corrected Total 19 103.2000000 Source DF Type I SS Mean Square F Value Pr > F resid 1 12.10000000 12.10000000 8.80 0.0180 period 1 1.80000000 1.80000000 1.31 0.2856 subj 9 78.30000000 8.70000000 6.33 0.0081 trt 0 0.00000000... Source DF Type III SS Mean Square F Value Pr > F resid 0 0.00000000... period 1 1.80000000 1.80000000 1.31 0.2856 subj 8 34.20000000 4.27500000 3.11 0.0646 trt 0 0.00000000... *************CONFOUNDING OF EFFECTS PRESENT********************; Replicated Latin Squares 23
Demonstration Using SAS proc mixed; class subj trt period; model y = period trt / s ddfm=kr; random subj; lsmeans trt; run; proc mixed; class subj trt period; model y = resid period trt / s ddfm=kr; ***With residual effect; random subj; lsmeans trt; Replicated Latin Squares 24
Mixed Output - No Residual Effects Cov Parm Estimate subj 1.4903 Residual 1.3750 Solution for Fixed Effects Effect Estimate Std Error DF t Value Pr > t Intercept 36.1000 0.5961 16.5 60.57 <.0001 period -0.6000 0.5244 8-1.14 0.2856 trt -3.2000 0.5244 8-6.10 0.0003 *** Type 3 Tests of Fixed Effects Effect DF DF F Value Pr > F period 1 8 1.31 0.2856 trt 1 8 37.24 0.0003 *** Least Squares Means Effect trt Estimate Std Error DF t Value Pr > t trt 1 32.6000 0.5353 8 60.90 <.0001 trt 2 35.8000 0.5353 8 66.88 <.0001 Replicated Latin Squares 25
Mixed Output - Residual Effects Cov Parm Estimate subj 1.4500 Residual 1.3750 Solution for Fixed Effects Effect Estimate Std Error DF t Value Pr > t Intercept 36.6000 0.7517 12.7 48.69 <.0001 resid -1.0000 0.9247 8-1.08 0.3110 *** period -0.6000 0.5244 8-1.14 0.2856 trt -4.2000 1.0630 12.7-3.95 0.0017 Least Squares Means Effect trt Estimate Std Error DF t Value Pr > t trt 1 32.1000 0.7045 10.5 45.57 <.0001 trt 2 36.3000 0.7045 10.5 51.53 <.0001 Replicated Latin Squares 26
SAS Code - p = 4 data new; input cow period trt resp @@; if period=1 then resid=0; else resid=a; resid1=0; resid2=0; resid3=0; if resid=1 then resid1=1; if resid=4 then resid1=-1; if resid=2 then resid2=1; if resid=4 then resid2=-1; if resid=3 then resid3=1; if resid=4 then resid3=-1; a=trt; retain a; cards; 1 1 1 38 1 2 2 32 1 3 3 35 1 4 4 33 2 1 2 39 2 2 3 37 2 3 4 36 2 4 1 30 3 1 3 45 3 2 4 38 3 3 1 37 3 4 2 35 4 1 4 41 4 2 1 30 4 3 2 32 4 4 3 33 ; proc print; run; Replicated Latin Squares 27
SAS Code proc glm; class cow period trt; model resp=cow period trt resid1 resid2 resid3 / solution; lsmeans trt / stderr pdiff cl lines; Obs cow period trt resp resid resid1 resid2 resid3 1 1 1 1 38 0 0 0 0 2 1 2 2 32 1 1 0 0 3 1 3 3 35 2 0 1 0 4 1 4 4 33 3 0 0 1 5 2 1 2 39 0 0 0 0 6 2 2 3 37 2 0 1 0 7 2 3 4 36 3 0 0 1 8 2 4 1 30 4-1 -1-1......... 16 4 4 3 33 2 0 1 0 Replicated Latin Squares 28
SAS Output Sum of Source DF Squares Mean Square F Value Pr > F Model 12 244.6875000 20.3906250 22.24 0.0133 Error 3 2.7500000 0.9166667 Corrected Total 15 247.4375000 Source DF Type I SS Mean Square F Value Pr > F cow 3 54.6875000 18.2291667 19.89 0.0175 period 3 147.1875000 49.0625000 53.52 0.0042 trt 3 40.6875000 13.5625000 14.80 0.0265 resid1 1 0.5625000 0.5625000 0.61 0.4906 *** Sum these resid2 1 0.5208333 0.5208333 0.57 0.5057 *** together to resid3 1 1.0416667 1.0416667 1.14 0.3646 *** get SS(resid) Source DF Type III SS Mean Square F Value Pr > F cow 3 46.0833333 15.3611111 16.76 0.0223 period 3 147.1875000 49.0625000 53.52 0.0042 trt 3 7.8409091 2.6136364 2.85 0.2062 *** Want to look at resid1 1 0.3750000 0.3750000 0.41 0.5679 trt after adjusting resid2 1 1.0416667 1.0416667 1.14 0.3646 for all else resid3 1 1.0416667 1.0416667 1.14 0.3646 Tests of importance based off of SAS results above Source DF Type III SS Mean Square F Value Pr > F trt 3 7.8409091 2.6136364 2.85 0.2062 resid 3 2.1250000 0.7083333 0.77 0.5814 Replicated Latin Squares 29
Standard Parameter Estimate Error t Value Pr > t Intercept 33.00000000 B 0.95742711 34.47 <.0001 cow 1 0.62500000 B 0.82915620 0.75 0.5057 cow 2 2.00000000 B 0.82915620 2.41 0.0948 cow 3 5.37500000 B 0.82915620 6.48 0.0075 cow 4 0.00000000 B... period 1 8.00000000 B 0.67700320 11.82 0.0013 period 2 1.50000000 B 0.67700320 2.22 0.1135 period 3 2.25000000 B 0.67700320 3.32 0.0449 period 4 0.00000000 B... trt 1-3.62500000 B 1.58771324-2.28 0.1066 trt 2-4.00000000 B 1.58771324-2.52 0.0862 trt 3-1.37500000 B 1.58771324-0.87 0.4502 trt 4 0.00000000 B... resid1 0.75000000 1.17260394 0.64 0.5679 resid2 1.25000000 1.17260394 1.07 0.3646 resid3-1.25000000 1.17260394-1.07 0.3646 Residual Effect of A increases response 0.75 units Residual Effect of B increases response 1.25 units Residual Effect of C decreases response 1.25 units Residual Effect of D decreases response 0.75 units LSMEAN trt 1 = 35.6875 + (-3.625 -.25(-3.625-4.000-1.375)) = 34.3125 = intercept + trt effect LSMEAN trt 2 = 35.6875 + (-4.000 -.25(-3.625-4.000-1.375)) = 33.9375 = intercept + trt effect Replicated Latin Squares 30
Least Squares Means Standard LSMEAN trt resp LSMEAN Error Pr > t Number 1 34.3125000 1.0013012 <.0001 1 2 33.9375000 1.0013012 <.0001 2 3 36.5625000 1.0013012 <.0001 3 4 37.9375000 1.0013012 <.0001 4 resp LSMEAN LSMEAN trt Number A 37.9375 4 4 A A 36.5625 3 3 A A 34.3125 1 1 A A 33.9375 2 2 Least Squares Means for Effect trt Difference Between 95% Confidence Limits for i j Means LSMean(i)-LSMean(j) 1 2 0.375000-4.677812 5.427812 1 3-2.250000-7.302812 2.802812 1 4-3.625000-8.677812 1.427812 2 3-2.625000-7.677812 2.427812 2 4-4.000000-9.052812 1.052812 3 4-1.375000-6.427812 3.677812 Replicated Latin Squares 31
SAS Code ***Provides same results as Proc GLM output; proc mixed; class cow period trt; model resp=period trt cow resid1 resid2 resid3 / solution; lsmeans trt / cl; contrast resid eff resid1 1, resid2 1, resid3 1; run; ***Slightly different because cows random effects; proc mixed; class cow period trt; model resp=period trt resid1 resid2 resid3 / solution; random cow; lsmeans trt / cl; contrast resid eff resid1 1, resid2 1, resid3 1; run; Replicated Latin Squares 32
Designs Balanced For Residual Effects Consider the following two Latin squares Suppose row=period and column=subject D C B A C D A B B A D C A B C D D C B A C A D B B D A C A B C D (Left) C D twice, A D once, B D never (Right) Each trt follows each other trt once Right square balanced for residual effects If p even, can be balanced using p subjects If p odd, need multiple of 2p subjects Replicated Latin Squares 33
Alternative Notation Consider a 2 2 crossover design with n subjects Subject n-1 Order 1 Period 1 Subject(order) n-2 Trt 1 Trt 1 Error n-2 Trt*Order 1 Error n-2 Period confounded with Trt*Order When subjects are random, don t expect Order differences so when significant, suggests there may be carryover effects. In fact, this is the same test as the difference in sums or including a residual effect. Replicated Latin Squares 34
Advantages Benefits and Drawbacks Subjects serve as their own control to reduce error May be able to get more volunteers if subjects particular to a treatment Drawbacks Subjects must be available for longer periods of time Carryover issue...are subjects the same at the start of each period? Crossover design avoided in comparative clinical studies Replicated Latin Squares 35