ANOVA Designs Involving Repeated Measures 46-511: One-Way Repeated Measures and Groups by Trials 1 Learning Objectives Be able to identify the advantages and disadvantages of repeated measures designs Understand how variance is partitioned in RM designs Comprehend variations possible with such designs Be familiar with post-hoc & planned comparisons using RM Designs Including Trend Analysis 2 The Design Repeated Measures Designs, a.k.a. Dependent Measures Designs Within-Subjects Designs Mixed Randomized-Repeated Designs, a.k.a. Groups by Trials Split Plot Factorial What are they Relative Advantages Relative Disadvantages 3 Some Examples Completely Within Designs 1-Way N-Way Mixed Randomized-Repeated Designs 1-Between by 1-Within N-Between by N-Within Characteristics of repeated measures designs Nature of the repeated measures Duration between measures 4 1-Way Repeated Measures ANOVA: Sources of Variation Between Subjects Between Treatments Within Subjects Within Treatments 5 One-Way Example Person Drug 1 Drug 2 Drug 3 Drug 4 Pi Mean 1 2 3 4 5 30 14 24 38 26 28 18 20 34 28 16 10 18 20 14 34 22 30 44 30 108 64 92 136 98 27.0 16.0 23.0 34.0 24.5 Tj 132 128 78 160 G = 498 Mean 26.4 25.6 15.6 32.0 24.9 GM=24.9 Five subjects, all are tested for reaction time after taking each of the four drugs, over a period of four days. 6 One-Way Example Person Drug 1 Drug 2 Drug 3 Drug 4 Pi Mean 1 2 3 4 5 30 14 24 38 26 28 18 20 34 28 16 10 18 20 14 34 22 30 44 30 108 64 92 136 98 27.0 16.0 23.0 34.0 24.5 132 128 78 160 G = 498 Tj . . . Between Treatments Within Subjects Between Subjects Effects Where does Within Treatment variation come from? 7 Two Structural Models The rosy additive model: Xij = μ + πi + τj + εij The model that assumes people x treatment interaction: Xij = μ + πi + τj + πτij + εij 8 Partitioning Sums of Squares: or, here we go again Between People SSB.PEOPLE k(Pi G) 2 Between Treatments SSTREAT n(Tj G) 2 9 Sums of Squares Within Within People SSW .PEOPLE ( X ij Pi ) i 2 j Within Treatments SSW .TREATMENT ( X ij Tj ) 2 j i 10 The error term Two ways to get it: SSRES = SSW.PEOPLE – SSTREAT SSRES = SSW.TREATMENT – SSB.PEOPLE How the error term differs from Between Subjects Design What the error term represents/contains 11 Source Table Source SS df MS SSB.PEOPLE 680.80 4 170.20 SSW.PEOPLE 811.00 15 54.07 SSTREAT 698.20 3 232.73 SSRES 112.80 12 9.40 1,491.80 19 78.52 SSTOT F p 24.759 0.000020 12 Missing Data in Within Subjects Designs Due to such things as Equipment failure Experimenter or subject error Loss of questionnaires Usual missing data solutions ignore design Y * ij sSi' aA'j T ' (a 1)(s 1) •Y*ij = predicted (missing) score •s = number of subjects •S’i = sum of known values for the case •a = number of levels of A •A’j = sum of known values of A •T’ = sum of all known values 13 Example Say subject #3 didn’t return to take drug 4 #3’s sum is now 62 Sum for A4 is 130 (160-30) Sum of known scores for entire table = 49830=468 5(62) 4(130) 468 * Y3,4 30.167 (4 1)(5 1) Error term must be reduced by number of imputed values (imputed values are not independent) 14 Assumptions Observations within each treatment cell are independent. Population treatment within each treatment must be normally distributed. Variances for the population treatments should be equivalent. Sphericity – that the variance of the difference scores for each pair of conditions is the same in the population. Alternatives if assumptions do not hold. 15 Mean Comparison Procedures Tukey Same as in 1-way between, substitute MS error (residual) for MS within & df error for df within Scheffe’ Same as in 1-way between, substitute MS error for MS within & df error for df within Bonferroni procedure Šidák procedure 16 Contrasts Unfortunately, contrasts are not quite a logical extension of contrasts from between subjects designs Affected by mild violations of sphericity Must determine variability specific to each contrast. Two methods, t and F. Let’s test the following contrast: C1: .5*Drug1+.5*Drug2 – Drug3=0. 17 Method One Ci t sM C Single Sample t-test: 2 where and sMc sC n 2 2 C ( C ) /n 2 i i sC n 1 18 Method 1 (Cont’d) (single sample t-test) Effect of Different Drugs on Reaction Time Person Drug 1 Drug 2 Drug 3 C1 (Using t-test) 1 30 28 16 13 2 14 18 10 6 3 24 20 18 4 4 38 34 20 16 5 26 28 14 13 Mean 26.4 25.6 15.6 ΣCi 52.00 Mean Ci 10.40 ΣCi2 646.00 19 Calculations for t: 2 646.00 (52) /5 2 sC 26.3 5 1 sM c 26.3 2.293 5 10.40 t 4.535 2.293 df = n-1; t(.05,4) = 2.78 20 Method 2: Using the F statistic 2 Sum of squares for contrast: Sum of squares for error term: 5(10.40)2 SSC 1.5 SSCerror nC SSC C 2j SSCerror C nC C 2j 2 i 2 646.00 5(10.40) 2 105.20 1.5 21 Method 2 (Cont’d) df = 1, (n – 1) MSCerror 105.20 26.3 4 540.8 F 20.563 26.3 Recalling that t2 = F; 4.5352 = 20.566 22 Effect sizes Partial ω2: Partial η2 / R2: (a 1)( FA 1) (a 1)( FA 1) an 2 p SS A SS A SS RES 2 p Cohen’s d: similar, have to decide on proper standard deviation 23 Power Use partial effect size 2 f 1 p2 ^ p Use G*Power or power charts. Assume ρ=.50 unless you know different. 24 Trend Analysis Example Mean Subject # Time 1 Time 2 Time 3 Time 4 Time 5 Time 6 1 43.00 31.00 10.00 9.00 4.00 4.00 2 40.00 30.00 9.00 6.00 4.00 5.00 3 49.00 33.00 12.00 5.00 6.00 3.00 4 39.00 26.00 11.00 8.00 5.00 5.00 5 41.00 28.00 8.00 6.00 5.00 5.00 6 44.00 34.00 9.00 7.00 7.00 6.00 42.67 30.33 9.83 6.83 5.17 4.67 Experiment on forgetting: six participants master a list of 50 words, then are asked to recall them the next day (time 1), one week later (time 2), and so on. 25 SPSS Output: Test of Sphericity & Summary Table Epsilon(a) Within Subjects Effect Mauchly's W factor1 .004 Error(factor1) 16.948 df Greenhous e-Geisser Sig. 14 Type III Sum of Squares Source factor1 Approx. Chi-Square .394 df .373 Mean Square HuynhFeldt .587 F Lowerbound .200 Sig. Sphericity Assumed 7694.250 5 1538.850 364.369 .000 Greenhouse-Geisser 7694.250 1.867 4121.540 364.369 .000 Huynh-Feldt 7694.250 2.937 2620.068 364.369 .000 Lower-bound 7694.250 1.000 7694.250 364.369 .000 Sphericity Assumed 105.583 25 4.223 Greenhouse-Geisser 105.583 9.334 11.311 Huynh-Feldt 105.583 14.683 7.191 Lower-bound 105.583 5.000 21.117 26 SPSS Output Polynomial Contrasts Source factor1 Type III Sum of Squares factor1 Linear 6179.336 1 6179.336 532.505 .000 Quadratic 1292.161 1 1292.161 502.740 .000 .112 1 .112 .125 .738 Order 4 143.006 1 143.006 39.040 .002 Order 5 79.636 1 79.636 33.393 .002 Linear 58.021 5 11.604 Quadratic 12.851 5 2.570 4.471 5 .894 Order 4 18.315 5 3.663 Order 5 11.924 5 2.385 Cubic Error(factor1) Cubic df Mean Square F Sig. 27 Graph of linear & quadratic trend Repeated Measures Trend Analysis Repeated Measures Trend Analysis 50.00 45.00 45.00 40.00 40.00 35.00 35.00 Recall N Correct Recall N Correct 30.00 25.00 20.00 y = -7.6714x + 43.433 R2 = 0.8031 15.00 30.00 Series1 Poly. (Series1) 25.00 Series1 Linear (Series1) 20.00 y = 2.4018x2 - 24.484x + 65.85 R2 = 0.971 15.00 10.00 10.00 5.00 5.00 0.00 Time 1 Time 2 Time 3 Time 4 -5.00 Time 5 Time 6 0.00 Time 1 Time 1 Time 2 Time 3 Time 4 Time 5 Time 6 Time 1 28 Groups by Trials Design: What it is? Combines between and within designs Yields effects for… Trials Groups Trials by Groups interaction Can be used to answer questions such as… Do test pattern scores (e.g., pre-post) differ by experimental vs. control group… Do women and men differ significantly in their ability to detect smell in varying conditions. Do patients receiving drug A have a different course of improvement than those receiving drug B? 29 Assumptions The usual assumptions for between subjects designs The usual assumptions for repeated measures designs Homogeneity of variance/covariance matrices by group 30 Partitioning Variance! Between Groups Variance – Subjects within Groups Variance – Between Trials Variance – Group by Trials Variance – Subjects within Groups within Trials Variance (residual) – 31 Between Group Variance Definitional Formula SS A nk ( Aj G) 2 Computational Formula A 2 j 2 G SS A nk njk 32 Subjects within Groups Definitional Formula SSsubj _ w. groups k ( Pi Aj ) 2 Computational Formula Pi A k nk 2 SSsubj _ w. groups 2 j 33 Between Trials Variance Definitional Formula SSB nj(Bk G) 2 Computational Formula B G SS B nj njk 2 k 2 34 Group by Trials Variance Definitional Formula SSAB n( AB jk A j Bk G) 2 Computational Formula SS AB AB2jk n A2j Bk2 G 2 nk nj njk 35 Subjects within Groups within Trials (residual) Definitional Formula SS BSubjects _W / In _ Groups [( ABijk Pi ) ( B k A j )] 2 i k Computational Formula SS BSubjects _W / In _ Groups X ijk 2 AB 2jk n A2j Pi k nk 2 36 Numerical Example Subject # B1: Month 1 B2: Month 2 B3: Month 3 1 2 3 4 5 1 1 3 5 2 3 4 3 5 4 6 8 6 7 5 A2: Mystery 6 7 8 9 10 3 4 5 4 4 1 4 3 2 5 0 2 2 0 3 A3: Romance 11 12 13 14 15 4 2 3 6 3 2 6 3 2 3 0 1 3 1 2 A1: Scifi. 37 Between Subjects Effects Tests of Between-Subjects Effects Measure: MEASURE_1 Transformed Variable: Average Source Intercept novtype Error Type III Sum of Squares 473.689 20.578 26.400 df 1 2 12 Mean Square 473.689 10.289 2.200 F 215.313 4.677 Sig . .000 .031 Estimates Measure: MEASURE_1 Genre of Novel Science Fiction Mystery Romance Mean 4.200 2.800 2.733 Std. Error .383 .383 .383 95% Confidence Interval Lower Bound Upper Bound 3.366 5.034 1.966 3.634 1.899 3.568 38 Within Subjects & Interaction Tests of W ithin-Subjects Effects Measure: MEASURE_1 Source factor1 factor1 * novtype Error(factor1) Sphericity Assumed Greenhouse-Geisser Huynh-Feldt Lower-bound Sphericity Assumed Greenhouse-Geisser Huynh-Feldt Lower-bound Sphericity Assumed Greenhouse-Geisser Huynh-Feldt Lower-bound Type III Sum of Squares .711 .711 .711 .711 71.422 71.422 71.422 71.422 37.200 37.200 37.200 37.200 df 2 1.651 2.000 1.000 4 3.303 4.000 2.000 24 19.818 24.000 12.000 Mean Square .356 .431 .356 .711 17.856 21.624 17.856 35.711 1.550 1.877 1.550 3.100 F .229 .229 .229 .229 11.520 11.520 11.520 11.520 Sig . .797 .755 .797 .641 .000 .000 .000 .002 39 Interaction Effect Estimated Marginal Means of MEASURE_1 3. Genre of Novel * factor1 Genre of Novel 7.00 Science Fiction Measure: MEASURE_1 Mystery Romance Estimated Marginal Means 6.00 Genre of Novel Science Fiction 5.00 4.00 Mystery 3.00 Romance 2.00 1.00 1 2 factor1 1 2 3 1 2 3 1 2 3 Mean Std. Error 2.400 .611 3.800 .627 6.400 .542 4.000 .611 3.000 .627 1.400 .542 3.600 .611 3.200 .627 1.400 .542 95% Confidence Interval Lower Bound Upper Bound 1.069 3.731 2.434 5.166 5.220 7.580 2.669 5.331 1.634 4.366 .220 2.580 2.269 4.931 1.834 4.566 .220 2.580 3 factor1 40 Two-Within Subject Factors Brief Example Effects Main effects for Factor A Main effects for Factor B Interaction effect for A x B 41 Numerical Example Number of Books Read each Month by Genre B1: Science Fiction B2: Mystery A1: Month 1 A2: Month 2 A3: Month 3 A1: Month 1 A2: Month 2 A3: Month 3 s1 1 3 6 5 4 1 s2 1 4 8 8 8 4 s3 3 3 6 4 5 3 s4 5 5 7 3 2 0 s5 2 4 5 5 6 3 A 3(month) x 2(genre) way within subjects ANOVA, where n=5 42 Summary Table Tests of W ithin-Subj ects Effects Measure: MEASURE_1 Source genre Error(genre) month Error(month) genre * month Error(genre*month) Sphericity Assumed Greenhouse-Geisser Huynh-Feldt Lower-bound Sphericity Assumed Greenhouse-Geisser Huynh-Feldt Lower-bound Sphericity Assumed Greenhouse-Geisser Huynh-Feldt Lower-bound Sphericity Assumed Greenhouse-Geisser Huynh-Feldt Lower-bound Sphericity Assumed Greenhouse-Geisser Huynh-Feldt Lower-bound Sphericity Assumed Greenhouse-Geisser Huynh-Feldt Lower-bound Type III Sum of Squares .133 .133 .133 .133 33.533 33.533 33.533 33.533 2.867 2.867 2.867 2.867 4.133 4.133 4.133 4.133 64.467 64.467 64.467 64.467 9.867 9.867 9.867 9.867 df 1 1.000 1.000 1.000 4 4.000 4.000 4.000 2 1.661 2.000 1.000 8 6.645 8.000 4.000 2 1.144 1.303 1.000 8 4.577 5.212 4.000 Mean Square .133 .133 .133 .133 8.383 8.383 8.383 8.383 1.433 1.726 1.433 2.867 .517 .622 .517 1.033 32.233 56.344 49.479 64.467 1.233 2.156 1.893 2.467 F .016 .016 .016 .016 Sig. .906 .906 .906 .906 2.774 2.774 2.774 2.774 .122 .136 .122 .171 26.135 26.135 26.135 26.135 .000 .004 .003 .007 43 And, the Interaction Plot 44 Two-way Repeated Measures ANOVA: Main effects Main effect for A B1: Science Fiction B2: Mystery A1: Month 1 A2: Month 2 A3: Month 3 A1: Month 1 A2: Month 2 A3: Month 3 s1 1 3 6 5 4 1 s2 1 4 8 8 8 4 s3 3 3 6 4 5 3 s4 5 5 7 3 2 0 s5 2 4 5 5 6 3 A1: Month 1 A2: Month 2 A3: Month 3 s1 1+5=6 3+4=7 6+1=7 s2 1+8=9 4+8=12 8+4=12 s3 3+4=7 3+5=8 6+3=9 s4 5+3=8 5+2=7 7+0=7 s5 2+5=7 4+6=10 5+3=8 45 Why different error terms? Recall SSRES=SSW.PEOPLE-SSTREAT A1: Month 1 A2: Month 2 A3: Month 3 SSW.PEOPLE s1 6 7 7 0.667 s2 9 12 12 6.000 s3 7 8 9 2.000 s4 8 7 7 0.667 s5 7 10 8 4.667 =14.000/2=7 SSRES=7-2.867=4.133 46 For B Main effect… B1: SciFi B2: Mystery SSW.PEOPLE s1 10 10 0.0 s2 13 20 24.5 s3 12 12 0.0 s4 17 5 72.0 s5 11 14 4.5 =101/3=33.667 SSRES=33.667-0.133=33.534 47 Finally, for AxB… B1: Science Fiction B2: Mystery A1: Month 1 A2: Month 2 A3: Month 3 A1: Month 1 A2: Month 2 A3: Month 3 SSW.PEOPLE s1 1 3 6 5 4 1 21.33 s2 1 4 8 8 8 4 43.50 s3 3 3 6 4 5 3 8.00 s4 5 5 7 3 2 0 31.33 s5 2 4 5 5 6 3 10.83 115.00 SSRES=SSW.PEOPLE – SSA – SSB – SSAB – SSAS – SSBS SSRES=115.0 – 2.867 – 0.133 – 64.467 – 4.133 – 33.533 = 9.867 48