Stat 512 Repeated Measures Designs Ch 18 Repeated measures involve the repeated observation of a response on the same experimental unit. Most often, repeated measures are observed over time. Occasionally, repeated measures occur on the same experimental unit, but at different treatment combinations. Most often a completely randomized design is utilized and repeated observations, over time, occur for each treatment level. Example: An experiment involving t = 3 different drugs was conducted to study each drug's effect on the heart rate of humans. The design consisted of the random selection of n r1 r2 r3 subjects that were randomly assigned to the 3 drugs in equal numbers (e.g., r1 r2 r3 r ). After a drug was administered, the heart rate (Y) was measured every 5 minutes for a total of p = 4 times. Neglecting the repeated measures, a partial ANOVA table for this experimental design is: Source Drug Subject(Drug) Total SS SS Drug SSSubject Drug SSTotal df t-1 (r-1)t rt-1 MS MS Drug MSSubject Drug Note that each subject within a drug is observed at each of the p time periods. Thus, each subject within a drug is acting as a block with respect to the p time periods. Thus, the design would appear to be a split plot experimental design, where the whole plot consisted of a CRD with a one-way treatment structure (drug) and the sub-plot design was an RCBD with a one-way treatment structure (time). Recall: RCBDs have all treatments randomly assigned within each blocks. 1 Stat 512 Question: Were the p time periods randomly assigned to each subject within a drug? Answer: NO! If they were, the experimental design would be a Split Plot with a CRD for the whole plot. The above design is a CRD having a one-way treatment structure with repeated measures. Bottom-line: If the time based observations on a subject have uniform covariance (compound symmetric covariance) structure, then repeated measures experiments can be analyzed using the procedures already outlined for the split plot design (or split block design). The assumption of a compound symmetric covariance can be assessed using SAS or many other statistical software packages. 2 Stat 512 Example (continued) Suppose for the experiment already outlined, there were 8 subjects assigned to each level of the factor DRUG, which has t = 3 levels (AX23, BWW9, and CONTROL). Further, suppose that p = 4 time measures (RATE1, RATE2, RATE3, and RATE4) were recorded. The following data for this experiment are taken from Milliken and Johnson (1984) and appear as follows: Subject 1 2 3 4 5 6 7 8 DRUG BWW9 AX23 CONTROL T1 T2 T3 T4 T1 T2 T3 T4 T1 T2 T3 T4 72 78 71 72 66 74 62 69 86 83 82 83 79 83 73 75 81 88 81 83 77 84 78 76 77 81 75 69 66 77 70 70 85 82 71 83 86 86 79 83 86 86 78 88 85 82 83 84 83 80 70 79 76 83 80 78 80 84 75 81 76 80 81 81 69 66 84 80 72 65 75 71 73 62 90 81 72 62 69 70 72 67 88 77 69 65 69 65 74 73 87 72 70 61 68 65 Linear Model Yijk i eWi j k ik eSi jk i =1, 2, , t; j = 1, 2, , r; k = 1, 2, ,p grand mean i ith drug effect eWi j jth subject effect within the ith drug (Whole Plot Error) k kth time effect ik drug by time interaction eSi jk residual error (Sub-plot Error) Assumptions: eWi j iidN 0, W2 , eSi jk N 0, S2 and Corr Yijk , Yijk for all i and j 3 Stat 512 Covariance matrix for the ith subject: 1 S2 . . . 1 1 . . .. . . . .. . . . .. . 1 Testing for Compound Symmetric Covariance Mauchly Sphericity Test is used to assess the assumption of compound symmetry. This test is produced by SAS Proc GLM. Huynh and Feldt (1970) showed that a less stringent requirement is required for the analysis of repeated measures data as a split-plot model. Huynh-Feldt developed a statistic that implies the compound symmetry condition is satisfied when the statistic has a value of 1.0. If the statistic differs from 1.0, an adjustment is made to the degrees of freedom for error to correct for the deviation from compound symmetry. If all else fails one can rely on the multivariate analysis of variance provided by Proc GLM. 4 Stat 512 title 'CRD with Repeated Measures'; title2 'Sample Unit = Subject (1 to 8), Treatment = Drug CONTROL)'; title3 'Repeated Measure = time (1 to 4)'; data a; input subject drug $ rate1 rate2 rate3 rate4 @@; cards; 1 AX23 72 86 81 77 1 BWW9 85 86 83 80 1 CONTROL 69 73 72 2 AX23 78 83 88 81 2 BWW9 82 86 80 84 2 CONTROL 66 62 67 3 AX23 71 82 81 75 3 BWW9 71 78 70 75 3 CONTROL 84 90 88 4 AX23 72 83 83 69 4 BWW9 83 88 79 81 4 CONTROL 80 81 77 5 AX23 66 79 77 66 5 BWW9 86 85 76 76 5 CONTROL 72 72 69 6 AX23 74 83 84 77 6 BWW9 85 82 83 80 6 CONTROL 65 62 65 7 AX23 62 73 78 70 7 BWW9 79 83 80 81 7 CONTROL 75 69 69 8 AX23 69 75 76 70 8 BWW9 83 84 78 81 8 CONTROL 71 70 65 ; proc print data = a; proc glm data = a; class subject drug; model rate1-rate4 = drug / nouni; repeated time 4 / printe summary; run; 5 (AX23, BWW9, 74 73 87 72 70 61 68 65 Stat 512 CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) Obs subject drug rate1 rate2 rate3 rate4 81 83 72 88 80 67 81 70 88 83 79 77 77 76 69 84 83 65 78 80 69 76 78 65 77 80 74 81 84 73 75 75 87 69 81 72 66 76 70 77 80 61 70 81 68 70 81 65 1 1 AX23 72 86 2 1 BWW9 85 86 3 1 CONTROL 69 73 4 2 AX23 78 83 5 2 BWW9 82 86 6 2 CONTROL 66 62 7 3 AX23 71 82 8 3 BWW9 71 78 9 3 CONTROL 84 90 10 4 AX23 72 83 11 4 BWW9 83 88 12 4 CONTROL 80 81 13 5 AX23 66 79 14 5 BWW9 86 85 15 5 CONTROL 72 72 16 6 AX23 74 83 17 6 BWW9 85 82 18 6 CONTROL 65 62 19 7 AX23 62 73 20 7 BWW9 79 83 21 7 CONTROL 75 69 22 8 AX23 69 75 23 8 BWW9 83 84 24 8 CONTROL 71 70 Note: The response is arranged in columns, one for each time of measurement. CRD with Repeated Measures 2 Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) The GLM Procedure Class Level Information Class Levels Values subject 8 1 2 3 4 5 6 7 8 drug 3 AX23 BWW9 CONTROL Number of Observations Read Number of Observations Used 6 24 24 1 Stat 512 CRD with Repeated Measures 3 Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) The GLM Procedure Repeated Measures Analysis of Variance Repeated Measures Level Information Dependent Variable rate1 rate2 rate3 rate4 Level of time 1 2 3 4 Partial Correlation Coefficients from the Error SSCP Matrix / Prob > |r| DF = 21 rate1 rate2 rate3 rate4 rate1 1.000000 rate2 0.828050 <.0001 0.825500 <.0001 0.644458 0.0012 0.828050 <.0001 1.000000 0.825500 <.0001 0.837311 <.0001 1.000000 0.644458 0.0012 0.722279 0.0001 0.834635 <.0001 1.000000 rate3 rate4 0.837311 <.0001 0.722279 0.0001 0.834635 <.0001 Note: The partial correlation coefficients provide a subjective measure of the relationship between the responses at different observation times. The p-values only indicate whether the correlation is significant, and does not pertain to whether the assumption of compound symmetry is satisfied. If compound symmetry is satisfied, the correlations should all be about the same. The correlations printed above range from 0.64 to 0.84, indicating that they are fairly similar in value. E = Error SSCP Matrix time_N represents the contrast between the nth level of time and the last time_1 time_2 time_3 time_1 time_2 time_3 461.88 309.38 226.38 309.38 418.25 193.38 226.38 193.38 217.25 7 Stat 512 Partial Correlation Coefficients from the Error SSCP Matrix of the Variables Defined by the Specified Transformation / Prob > |r| DF = 21 time_1 time_2 time_3 time_1 1.000000 0.703890 0.0003 0.714638 0.0002 time_2 0.703890 0.0003 1.000000 0.641509 0.0013 time_3 0.714638 0.0002 0.641509 0.0013 1.000000 8 Stat 512 CRD with Repeated Measures 4 Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) The GLM Procedure Repeated Measures Analysis of Variance Sphericity Tests Variables DF Mauchly's Criterion Chi-Square Pr > ChiSq 5 5 0.1952368 0.6693259 32.217081 7.9181595 <.0001 0.1608 Transformed Variates Orthogonal Components Note: The Sphericity test based on the orthogonal components is used to assess whether the assumption of compound symmetry is satisfied. The null hypothesis for the test is that compound symmetry is satisfied and the alternative hypothesis is that compound symmetry is not satisfied. For the above analysis, the p-value is 0.1608, so the null hypothesis is not rejected. The data approximately satisfy the assumption of compound symmetry. MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no time Effect H = Type III SSCP Matrix for time E = Error SSCP Matrix S=1 Statistic Wilks' Lambda Pillai's Trace Hotelling-Lawley Trace Roy's Greatest Root M=0.5 N=8.5 Value F Value Num DF Den DF Pr > F 0.29886466 0.70113534 2.34599609 2.34599609 14.86 14.86 14.86 14.86 3 3 3 3 19 19 19 19 <.0001 <.0001 <.0001 <.0001 MANOVA Test Criteria and F Approximations for the Hypothesis of no time*drug Effect H = Type III SSCP Matrix for time*drug E = Error SSCP Matrix S=2 Statistic Wilks' Lambda Pillai's Trace Hotelling-Lawley Trace Roy's Greatest Root M=0 N=8.5 Value F Value Num DF Den DF Pr > F 0.10831123 1.09156533 6.38726223 6.08394057 12.91 8.01 19.77 40.56 6 6 6 3 38 40 23.636 20 <.0001 <.0001 <.0001 <.0001 NOTE: F Statistic for Roy's Greatest Root is an upper bound. NOTE: F Statistic for Wilks' Lambda is exact. NOTE: F Statistic for Roy's Greatest Root is an upper bound. Note: The Manova tests assess the components of the repeated measures ANOVA associated with time (e.g., time and time by drug interaction). If compound symmetry is not satisfied, one can always rely on the multivariate tests, since this is a more general approach. However, it is also a less powerful procedure. It is generally better to use the ANOVA procedures when appropriate. 9 Stat 512 For the above multivariate tests, it is clear that an interaction between the time and drug factors exists, since each of the tests statistics is significant (p-value < 0.0001). However, since the assumption of compound symmetry was satisfied for the problem at hand, it is probably best to use the results from the univariate analysis. CRD with Repeated Measures 5 Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) The GLM Procedure Repeated Measures Analysis of Variance Tests of Hypotheses for Between Subjects Effects Source DF Type III SS Mean Square F Value Pr > F drug 2 1315.083333 657.541667 5.95 0.0090 Error 21 2320.156250 110.483631 Note: Assessing differences between the means effect of the three drugs is shown in the above results. A significant difference among the three drug means is apparent (p-value = 0.009). However, on should assess the interaction between the drug and time before assessing the main effects of drug or time. CRD with Repeated Measures 6 Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) The GLM Procedure Repeated Measures Analysis of Variance Univariate Tests of Hypotheses for Within Subject Effects Source DF Type III SS Mean Square F Value Pr > F time time*drug Error(time) 3 6 63 282.6145833 531.1666667 458.4687500 94.2048611 88.5277778 7.2772817 12.95 12.16 <.0001 <.0001 Greenhouse-Geisser Epsilon Huynh-Feldt Epsilon Adj Pr > F G - G H - F <.0001 <.0001 <.0001 <.0001 0.7986 0.9944 Note: The above results for the effect of time and time by drug interaction indicate that both are significant (p-value < 0.0001 for both). Of course a significant interaction would mean the care must be taken when assessing differences between the mean effect of the three drugs or time, since the effect changes over time. In order to assess the effect of the different levels of drug correctly one would need to produce the multiple comparisons of drug at each time point. This is where Proc GLM with the Repeated statement becomes a liability. Using the Repeated statement in Proc GLM removes the use of the LSMeans statement for constructing the comparisons among the drug means at each level of time. Because of this another approach must be utilized. CRD with Repeated Measures 7 Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) The GLM Procedure Repeated Measures Analysis of Variance Analysis of Variance of Contrast Variables 10 Stat 512 time_N represents the contrast between the nth level of time and the last Contrast Variable: time_1 Source DF Type III SS Mean Square F Value Pr > F Mean drug Error 1 2 21 2.0416667 103.0833333 461.8750000 2.0416667 51.5416667 21.9940476 0.09 2.34 0.7636 0.1206 Source DF Type III SS Mean Square F Value Pr > F Mean drug Error 1 2 21 433.5000000 156.2500000 418.2500000 433.5000000 78.1250000 19.9166667 21.77 3.92 0.0001 0.0357 Source DF Type III SS Mean Square F Value Pr > F Mean drug Error 1 2 21 130.6666667 376.0833333 217.2500000 130.6666667 188.0416667 10.3452381 12.63 18.18 0.0019 <.0001 Contrast Variable: time_2 Contrast Variable: time_3 Note: The above are the linear, quadratic and cubic orthogonal polynomials associated with the time effect. The graph of the estimated mean heart rate across time, separate for each drug, is presented in the following graph: The graph clearly shows the interaction that was indicated by the repeated measure analysis. So, how do you assess the differences between the mean heart rate for each drug, since lsmeans are not available for the drug by time components? 11 Stat 512 The following is a reproduction, in part, of the repeated measures analysis produced by SAS Proc GLM using the Repeated statement. In addition, the SAS code has been modified to a form suitable for analysis as a Split-Plot Design, so that the LSMeans statement can be used to assess pairwise differences between the means at the level of the sub-plot. SAS Code: options pageno = 1 nodate center; title 'CRD with Repeated Measures'; title2 'Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL)'; title3 'Repeated Measure = time (1 to 4)'; data drug; input person medicine $ rate1 rate2 rate3 rate4 @@; cards; 1 AX23 72 86 81 77 1 BWW9 85 86 83 80 1 CONTROL 69 73 72 74 2 AX23 78 83 88 81 2 BWW9 82 86 80 84 2 CONTROL 66 62 67 73 3 AX23 71 82 81 75 3 BWW9 71 78 70 75 3 CONTROL 84 90 88 87 4 AX23 72 83 83 69 4 BWW9 83 88 79 81 4 CONTROL 80 81 77 72 5 AX23 66 79 77 66 5 BWW9 86 85 76 76 5 CONTROL 72 72 69 70 6 AX23 74 83 84 77 6 BWW9 85 82 83 80 6 CONTROL 65 62 65 61 7 AX23 62 73 78 70 7 BWW9 79 83 80 81 7 CONTROL 75 69 69 68 8 AX23 69 75 76 70 8 BWW9 83 84 78 81 8 CONTROL 71 70 65 65 ; proc print data = drug; run; proc glm data = drug; class person medicine; model rate1-rate4 = medicine / nouni; repeated time 4 / printe summary; run; title4 'Analysis Using Proc GLM using a Split Plot Model Structure'; data drug; set drug; subject = person; drug =medicine; rate = rate1; time = 5; output; subject = person; drug =medicine; rate = rate2; time = 10; output; subject = person; drug =medicine; rate = rate3; time = 15; output; subject = person; drug =medicine; rate = rate4; time = 20; output; keep subject drug rate time; run; proc print data = drug; run; proc glm data = drug; class subject drug time; model rate = drug subject(drug) time time*drug; test h = drug e = subject(drug); lsmeans time*drug / pdiff stderr; run; CRD with Repeated Measures 1 Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) 12 Stat 512 Repeated Measure = time (1 to 4) Obs person medicine rate1 rate2 rate3 rate4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 AX23 BWW9 CONTROL AX23 BWW9 CONTROL AX23 BWW9 CONTROL AX23 BWW9 CONTROL AX23 BWW9 CONTROL AX23 BWW9 CONTROL AX23 BWW9 CONTROL AX23 BWW9 CONTROL 72 85 69 78 82 66 71 71 84 72 83 80 66 86 72 74 85 65 62 79 75 69 83 71 86 86 73 83 86 62 82 78 90 83 88 81 79 85 72 83 82 62 73 83 69 75 84 70 81 83 72 88 80 67 81 70 88 83 79 77 77 76 69 84 83 65 78 80 69 76 78 65 77 80 74 81 84 73 75 75 87 69 81 72 66 76 70 77 80 61 70 81 68 70 81 65 CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) 2 The GLM Procedure Class Level Information Class Levels Values person 8 1 2 3 4 5 6 7 8 medicine 3 AX23 BWW9 CONTROL Number of Observations Read Number of Observations Used 24 24 CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) 5 The GLM Procedure Repeated Measures Analysis of Variance Tests of Hypotheses for Between Subjects Effects Source DF Type III SS Mean Square F Value Pr > F medicine Error 2 21 1315.083333 2320.156250 657.541667 110.483631 5.95 0.0090 CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) The GLM Procedure 13 6 Stat 512 Repeated Measures Analysis of Variance Univariate Tests of Hypotheses for Within Subject Effects Source DF Type III SS Mean Square F Value Pr > F time time*medicine Error(time) 3 6 63 282.6145833 531.1666667 458.4687500 94.2048611 88.5277778 7.2772817 12.95 12.16 <.0001 <.0001 Greenhouse-Geisser Epsilon Huynh-Feldt Epsilon Adj Pr > F G - G H - F <.0001 <.0001 <.0001 <.0001 0.7986 0.9944 The above results are only a partial representation of the results computed using Repeated statement. However, they are sufficient for a comparison to the results when the data are analyzed using Proc GLM, but based on the model for a split plot design. 14 Stat 512 CRD with Repeated Measures 8 Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) Analysis Using Proc GLM using a Split Plot Model Structure Obs subject 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 drug AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL 15 rate time 72 86 81 77 85 86 83 80 69 73 72 74 78 83 88 81 82 86 80 84 66 62 67 73 71 82 81 75 71 78 70 75 84 90 88 87 72 83 83 69 83 88 79 81 80 81 77 72 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 Stat 512 CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) Analysis Using Proc GLM using a Split Plot Model Structure Obs subject 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 drug AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL 16 rate time 66 79 77 66 86 85 76 76 72 72 69 70 74 83 84 77 85 82 83 80 65 62 65 61 62 73 78 70 79 83 80 81 75 69 69 68 69 75 76 70 83 84 78 81 71 70 65 65 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 9 Stat 512 CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) Analysis Using Proc GLM using a Split Plot Model Structure 10 The GLM Procedure Class Level Information Class Levels Values subject 8 1 2 3 4 5 6 7 8 drug 3 AX23 BWW9 CONTROL time 4 5 10 15 20 Number of Observations Read Number of Observations Used 96 96 CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) Analysis Using Proc GLM using a Split Plot Model Structure 11 The GLM Procedure Dependent Variable: rate Source DF Sum of Squares Mean Square F Value Pr > F Model 32 4449.020833 139.031901 19.10 <.0001 Error 63 458.468750 7.277282 Corrected Total 95 4907.489583 R-Square Coeff Var Root MSE rate Mean 0.906578 3.529696 2.697644 76.42708 Source DF Type I SS Mean Square F Value Pr > F drug subject(drug) time drug*time 2 21 3 6 1315.083333 2320.156250 282.614583 531.166667 657.541667 110.483631 94.204861 88.527778 90.36 15.18 12.95 12.16 <.0001 <.0001 <.0001 <.0001 Source DF Type III SS Mean Square F Value Pr > F drug subject(drug) time drug*time 2 21 3 6 1315.083333 2320.156250 282.614583 531.166667 657.541667 110.483631 94.204861 88.527778 90.36 15.18 12.95 12.16 <.0001 <.0001 <.0001 <.0001 Tests of Hypotheses Using the Type III MS for subject(drug) as an Error Term Source DF Type III SS Mean Square 17 F Value Pr > F Stat 512 drug 2 1315.083333 657.541667 5.95 0.0090 The sum of squares for the model, error, drug, subject(drug), time and drug by time interaction are identical to the sum of squares produced by SAS Proc GLM using the Repeated statement. CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) Analysis Using Proc GLM using a Split Plot Model Structure 12 The GLM Procedure Least Squares Means drug time AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL 5 10 15 20 5 10 15 20 5 10 15 20 rate LSMEAN Standard Error Pr > |t| LSMEAN Number 70.5000000 80.5000000 81.0000000 73.1250000 81.7500000 84.0000000 78.6250000 79.7500000 72.7500000 72.3750000 71.5000000 71.2500000 0.9537611 0.9537611 0.9537611 0.9537611 0.9537611 0.9537611 0.9537611 0.9537611 0.9537611 0.9537611 0.9537611 0.9537611 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 1 2 3 4 5 6 7 8 9 10 11 12 Least Squares Means for effect drug*time Pr > |t| for H0: LSMean(i)=LSMean(j) Dependent Variable: rate i/j 1 1 2 3 4 5 6 7 8 9 10 11 12 <.0001 <.0001 0.0561 <.0001 <.0001 <.0001 <.0001 0.1003 0.1694 0.4612 0.5802 2 3 4 5 6 <.0001 <.0001 0.7121 0.0561 <.0001 <.0001 <.0001 0.3576 0.5802 <.0001 <.0001 0.0118 0.0297 <.0001 0.1003 0.7121 <.0001 0.3576 0.0118 0.1694 0.5802 <.0001 <.0001 <.0001 <.0001 <.0001 0.5802 0.0297 0.0831 0.3576 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 0.0001 <.0001 0.7819 0.5802 0.2328 0.1694 0.1003 0.0238 0.1431 <.0001 <.0001 <.0001 <.0001 0.0002 0.0025 <.0001 <.0001 <.0001 <.0001 Least Squares Means for effect drug*time Pr > |t| for H0: LSMean(i)=LSMean(j) Dependent Variable: rate i/j 1 2 3 7 8 9 10 11 12 <.0001 0.1694 0.0831 <.0001 0.5802 0.3576 0.1003 <.0001 <.0001 0.1694 <.0001 <.0001 0.4612 <.0001 <.0001 0.5802 <.0001 <.0001 CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) Analysis Using Proc GLM using a Split Plot Model Structure 18 13 Stat 512 The GLM Procedure Least Squares Means Least Squares Means for effect drug*time Pr > |t| for H0: LSMean(i)=LSMean(j) Dependent Variable: rate i/j 4 5 6 7 8 9 10 11 12 7 8 9 10 11 12 0.0001 0.0238 0.0002 <.0001 0.1431 0.0025 0.4074 0.7819 <.0001 <.0001 <.0001 <.0001 0.5802 <.0001 <.0001 <.0001 <.0001 0.7819 0.2328 <.0001 <.0001 <.0001 <.0001 0.3576 0.5189 0.1694 <.0001 <.0001 <.0001 <.0001 0.2703 0.4074 0.8536 0.4074 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 0.7819 0.3576 0.2703 0.5189 0.4074 0.8536 NOTE: To ensure overall protection level, only probabilities associated with pre-planned comparisons should be used. The LSMeans statement provides one with the ability to assess differences between means at the sub-plot level. In this case, comparisons can be made between the means for the four time periods at each level of the Drug (see bold above). You can also compare whole plot means (Drug) across each level of the subplot (Time), or across different levels of the subplot. However, the pvalues for the LSD’s produced by the LSMeans statement are not correct. This is because the standard errors and the degrees of freedom for the pairwise tests are a linear combination of the whole plot and sub-plot components (see the notes on Split-plot designs in chapter 14). Therefore, the above LSMeans for the whole plot means (Drugs) should only be considered a reasonable approximation. Proper computations of the LSDs in this case are difficult at best, since they are not computed by Proc GLM. The appropriate methods for computing the estimated standard errors and LSDs when the assumption of compound symmetry is met are the same as the methods outlined in Chapter 14 (split-plot designs). Assuming that the number of replicates per whole-plot treatment are the same for all treatments (r) and there are b and are as follows: Comparison of Whole Plot Means 19 Stat 512 Each whole plot mean Yi.. is constructed from rb observations and the F test for the global comparison of whole plot means uses the MSWhole Plot Error , the estimated standard error for the comparison of two whole plot means is se Yi.. Yi.. 2 MSWhole Plot Error r p The t statistic for the comparison of two whole plot means (e.g., H 0 : i.. i.. 0 ) is t Yi.. Yi.. 2.MSWhole Plot Error rp with rejection region: t t , dfWhole Plot Error 2 The above LSD formulation is valid for comparison of whole plot marginal means only. Comparison of Sub-Plot Means Comparing two sub-plot means Y..k is based on rt values, along with the sub-plot error. The estimated standard error for the comparison of two sub-plot treatment means is se Y..k Y..k 2 MSSub- Plot Error r t The t statistic for the comparison of two sub-plot means (e.g., Ho: H 0 : ..k ..k 0 ) is t Y..k Y..k 2.MSSub Plot Error rt with rejection region: t t , dfSub- Plot Error 2 The above LSD formulation is valid for comparison of sub-plot marginal means only. Comparison of Whole Plot Means within the same or different Sub-Plot Treatments Comparing two whole plot means at the same level of the sub-plot treatment, or different levels at different levels of the sub-plot treatment requires a substantial effort individual if the results of the Proc GLM are used. Cell means Yi.k within the same whole plot treatment are based on rt values. In addition, the estimated standard error is a function of both the whole plot error 20 Stat 512 and the sub-plot error. The estimated standard error for the comparison of two whole plot treatment means at the same or different levels of the sub-plot is MSWhole Plot Error p 1 MS Sub- Plot Error se Yi.k Yi.k 2 rp and the appropriate t quantile for the t statistic is t t * , df 2 , r 1t 2 MSWhole Plot Error t , r 1t p 1 2 p 1 MS Sub- Plot Error MSWhole Plot Error p 1 MS Sub- Plot Error This computation poses a substantial burden if performed by hand. An alternative approach is to use SAS Proc Mixed. The LSMeans procedure in SAS Proc Mixed, when used with the Satterwaithe approximation (or the Kenward and Roger variant), will produce the correct LSD value for multiple comparisons. For the heart rate drug study the following code is used to implement SAS Proc Mixed under the compound symmetric covariance structure: options pageno = 1 nodate center; title 'CRD with Repeated Measures'; title2 'Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL)'; title3 'Repeated Measure = time (1 to 4)'; data drug; input person medicine $ rate1 rate2 rate3 rate4 @@; cards; 1 AX23 72 86 81 77 9 BWW9 85 86 83 80 17 CONTROL 69 73 72 74 2 AX23 78 83 88 81 10 BWW9 82 86 80 84 18 CONTROL 66 62 67 73 3 AX23 71 82 81 75 11 BWW9 71 78 70 75 19 CONTROL 84 90 88 87 4 AX23 72 83 83 69 12 BWW9 83 88 79 81 20 CONTROL 80 81 77 72 5 AX23 66 79 77 66 13 BWW9 86 85 76 76 21 CONTROL 72 72 69 70 6 AX23 74 83 84 77 14 BWW9 85 82 83 80 22 CONTROL 65 62 65 61 7 AX23 62 73 78 70 15 BWW9 79 83 80 81 23 CONTROL 75 69 69 68 8 AX23 69 75 76 70 16 BWW9 83 84 78 81 24 CONTROL 71 70 65 65 ; run; proc print data = drug; run; proc glm data = drug; class person medicine; model rate1-rate4 = medicine / nouni; 21 Stat 512 repeated time 4 / printe summary; run; title4 'Analysis Using Proc GLM using a Split Plot Model Structure'; data drug; set drug; subject = person; drug =medicine; rate = rate1; time = 5; output; subject = person; drug =medicine; rate = rate2; time = 10; output; subject = person; drug =medicine; rate = rate3; time = 15; output; subject = person; drug =medicine; rate = rate4; time = 20; output; keep subject drug rate time; run; proc print data = drug; run; proc mixed data = drug; class subject drug time; model rate = drug time time*drug/ ddfm=satterth; repeated /type = cs subject=subject r; lsmeans time*drug / pdiff; run; Note that the subject variable (= person) is now numbered from 1 to 24 so that SAS Proc Mixed will distinguish each replicate (subject). This is necessary for Proc Mixed, but not for Proc GLM, if the correct analysis is desired. The output for the above SAS code is as follows: CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) Analysis Using Proc GLM using a Split Plot Model Structure Obs 1 2 subject 1 1 drug rate time AX23 AX23 72 86 5 10 22 1 Stat 512 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 1 1 9 9 9 9 17 17 17 17 2 2 2 2 10 10 10 10 18 18 18 18 3 3 3 3 11 11 11 11 19 19 19 19 4 4 4 4 12 12 12 12 20 20 20 20 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL 81 77 85 86 83 80 69 73 72 74 78 83 88 81 82 86 80 84 66 62 67 73 71 82 81 75 71 78 70 75 84 90 88 87 72 83 83 69 83 88 79 81 80 81 77 72 23 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 Stat 512 CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) Analysis Using Proc GLM using a Split Plot Model Structure Obs subject 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 5 5 5 5 13 13 13 13 21 21 21 21 6 6 6 6 14 14 14 14 22 22 22 22 7 7 7 7 15 15 15 15 23 23 23 23 8 8 8 8 16 16 16 16 24 24 24 24 drug AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL 24 rate time 66 79 77 66 86 85 76 76 72 72 69 70 74 83 84 77 85 82 83 80 65 62 65 61 62 73 78 70 79 83 80 81 75 69 69 68 69 75 76 70 83 84 78 81 71 70 65 65 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 5 10 15 20 2 Stat 512 CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) Analysis Using Proc GLM using a Split Plot Model Structure The Mixed Procedure Model Information Data Set Dependent Variable Covariance Structure Subject Effect Estimation Method Residual Variance Method Fixed Effects SE Method Degrees of Freedom Method WORK.DRUG rate Compound Symmetry subject REML Profile Model-Based Satterthwaite Class Level Information Class subject drug time Levels Values 24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 AX23 BWW9 CONTROL 5 10 15 20 3 4 Dimensions Covariance Parameters Columns in X Columns in Z Subjects Max Obs Per Subject 2 20 0 24 4 Number of Observations Number of Observations Read Number of Observations Used Number of Observations Not Used 96 96 0 Iteration History Iteration Evaluations -2 Res Log Like Criterion 0 1 1 1 557.24212530 487.17690350 0.00000000 25 3 Stat 512 CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) Analysis Using Proc GLM using a Split Plot Model Structure The Mixed Procedure Convergence criteria met. 4 Estimated R Matrix for subject 1 Row Col1 Col2 Col3 Col4 1 33.0789 25.8016 25.8016 25.8016 2 25.8016 33.0789 25.8016 25.8016 3 25.8016 25.8016 33.0789 25.8016 4 25.8016 25.8016 25.8016 33.0789 The above covariance matrix is computed under the assumption of compound symmetry. Covariance Parameter Estimates Cov Parm Subject Estimate CS Residual subject 25.8016 7.2773 Fit Statistics -2 Res Log Likelihood AIC (smaller is better) AICC (smaller is better) BIC (smaller is better) 487.2 491.2 491.3 493.5 Null Model Likelihood Ratio Test DF Chi-Square Pr > ChiSq 1 70.07 <.0001 The chi-square test presented above assesses the appropriateness of the selected covariance structure, compound symmetric in this case, relative to the default model of independence and constant variance. Type 3 Tests of Fixed Effects Effect Num DF Den DF F Value Pr > F drug 2 21 5.95 0.0090 time 3 63 12.95 <.0001 drug*time 6 63 12.16 <.0001 The test statistics computed above are the same as those computed for the split-plot and repeated measures model based on SAS Proc GLM. This includes the denominator degrees of freedom, which are computed based on the assumption of compound symmetry. 26 Stat 512 CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) Analysis Using Proc GLM using a Split Plot Model Structure 5 The Mixed Procedure Least Squares Means Effect drug time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL 5 10 15 20 5 10 15 20 5 10 15 20 Estimate Standard Error DF t Value Pr > |t| 70.5000 80.5000 81.0000 73.1250 81.7500 84.0000 78.6250 79.7500 72.7500 72.3750 71.5000 71.2500 2.0334 2.0334 2.0334 2.0334 2.0334 2.0334 2.0334 2.0334 2.0334 2.0334 2.0334 2.0334 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 34.67 39.59 39.83 35.96 40.20 41.31 38.67 39.22 35.78 35.59 35.16 35.04 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 <.0001 Differences of Least Squares Means Effect drug time _drug _time Estimate Standard Error DF t Value Pr > |t| drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 5 5 5 5 5 5 5 5 5 5 5 10 10 10 10 10 10 10 10 10 10 15 15 15 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL AX23 AX23 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL AX23 BWW9 BWW9 10 15 20 5 10 15 20 5 10 15 20 15 20 5 10 15 20 5 10 15 20 20 5 10 -10.0000 -10.5000 -2.6250 -11.2500 -13.5000 -8.1250 -9.2500 -2.2500 -1.8750 -1.0000 -0.7500 -0.5000 7.3750 -1.2500 -3.5000 1.8750 0.7500 7.7500 8.1250 9.0000 9.2500 7.8750 -0.7500 -3.0000 1.3488 1.3488 1.3488 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 1.3488 1.3488 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 1.3488 2.8757 2.8757 63 63 63 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 63 63 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 63 29.7 29.7 -7.41 -7.78 -1.95 -3.91 -4.69 -2.83 -3.22 -0.78 -0.65 -0.35 -0.26 -0.37 5.47 -0.43 -1.22 0.65 0.26 2.69 2.83 3.13 3.22 5.84 -0.26 -1.04 <.0001 <.0001 0.0561 0.0005 <.0001 0.0084 0.0031 0.4402 0.5194 0.7305 0.7960 0.7121 <.0001 0.6669 0.2331 0.5194 0.7960 0.0115 0.0084 0.0039 0.0031 <.0001 0.7960 0.3053 27 Stat 512 CRD with Repeated Measures Sample Unit = Subject (1 to 8), Treatment = Drug (AX23, BWW9, CONTROL) Repeated Measure = time (1 to 4) Analysis Using Proc GLM using a Split Plot Model Structure 6 The Mixed Procedure Differences of Least Squares Means Effect drug time _drug _time Estimate Standard Error DF t Value Pr > |t| drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time drug*time AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 AX23 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL CONTROL CONTROL 15 15 15 15 15 15 20 20 20 20 20 20 20 20 5 5 5 5 5 5 5 10 10 10 10 10 10 15 15 15 15 15 20 20 20 20 5 5 5 10 10 15 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL BWW9 BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL BWW9 BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL BWW9 BWW9 CONTROL CONTROL CONTROL CONTROL BWW9 CONTROL CONTROL CONTROL CONTROL CONTROL CONTROL CONTROL CONTROL CONTROL CONTROL CONTROL CONTROL CONTROL CONTROL 15 20 5 10 15 20 5 10 15 20 5 10 15 20 10 15 20 5 10 15 20 15 20 5 10 15 20 20 5 10 15 20 5 10 15 20 10 15 20 15 20 20 2.3750 1.2500 8.2500 8.6250 9.5000 9.7500 -8.6250 -10.8750 -5.5000 -6.6250 0.3750 0.7500 1.6250 1.8750 -2.2500 3.1250 2.0000 9.0000 9.3750 10.2500 10.5000 5.3750 4.2500 11.2500 11.6250 12.5000 12.7500 -1.1250 5.8750 6.2500 7.1250 7.3750 7.0000 7.3750 8.2500 8.5000 0.3750 1.2500 1.5000 0.8750 1.1250 0.2500 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 1.3488 1.3488 1.3488 2.8757 2.8757 2.8757 2.8757 1.3488 1.3488 2.8757 2.8757 2.8757 2.8757 1.3488 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 2.8757 1.3488 1.3488 1.3488 1.3488 1.3488 1.3488 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 63 63 63 29.7 29.7 29.7 29.7 63 63 29.7 29.7 29.7 29.7 63 29.7 29.7 29.7 29.7 29.7 29.7 29.7 29.7 63 63 63 63 63 63 0.83 0.43 2.87 3.00 3.30 3.39 -3.00 -3.78 -1.91 -2.30 0.13 0.26 0.57 0.65 -1.67 2.32 1.48 3.13 3.26 3.56 3.65 3.98 3.15 3.91 4.04 4.35 4.43 -0.83 2.04 2.17 2.48 2.56 2.43 2.56 2.87 2.96 0.28 0.93 1.11 0.65 0.83 0.19 0.4154 0.6669 0.0075 0.0054 0.0025 0.0020 0.0054 0.0007 0.0655 0.0284 0.8971 0.7960 0.5763 0.5194 0.1003 0.0238 0.1431 0.0039 0.0028 0.0013 0.0010 0.0002 0.0025 0.0005 0.0003 0.0001 0.0001 0.4074 0.0500 0.0379 0.0191 0.0156 0.0211 0.0156 0.0075 0.0061 0.7819 0.3576 0.2703 0.5189 0.4074 0.8536 Notice that the degrees of freedom for the pairwise comparisons shown above are either 29.7 or 63. Those comparisons with 63 degrees of freedom are comparisons of sub-plot treatments (time) means at the same level of the whole plot. Those comparisons with 29.7 degrees of freedom are comparisons of whole plot treatments (drug) means at the same or different levels of the sub-plot. The 29.7 degrees of freedom represent the Satterwaithe approximation to the degrees of freedom outlined on page 25 of these notes. In addition, 28 Stat 512 the estimated standard errors listed along side these comparisons are the Satterwaithe approximations to the standard error for the comparison of two means (also listed on page 25). 29