Download presentation
Presentation is loading. Please wait.
1
Repeated Measures Design
Group 5: Jian Wang, Xi Zhang, Yan Cao, Qichao Sun, Jixiang Zhang, Zishan Chen, Xing Peng, Xiao Liu
2
Introduction to repeated measures design
Jian Wang
3
Review of paired sample t-test
A paired sample t-test is used to determine whether there is a significant difference between the average values of the same measurement made under two different conditions. The usual null hypothesis is that the difference in the mean values is zero. ---repeated measures design is actually an extension of paired sample t-test or we can say paired t test is a special case in the repeated measures design(which involved only two related measures)
4
What is repeated measures design
A repeated-measures design is one in which multiple, or repeated, measurements are made on each experimental unit under different conditions.
5
Simple Example Students were asked to rate their stress on a 50 point scale in the week before, the week of, or the week after their midterm exam. Further study of examples in the following
6
Advantages-why use repeated measures design
Require fewer participants--This design is economical because each member is measured under all conditions. Eliminating individual differences-- collecting data from the same participants under repeated conditions so it reduces individual difference and the test becomes more powerful. Longitudinal analysis—Repeated measure design is especially good for researchers to monitor how participants change over time.
7
Disadvantage Carry-over effect:an effect that “carries over” from one experimental condition to another when subjects perform in more than one condition.
8
One-Way Repeated Measures ANOVA
9
Compared with One-Way ANOVA
One-Way ANOVA: we look at differences between different samples that come from different groups within a single factor. That is, 1 factor, k levels k separate groups are compared. One-Way RM ANOVA: we can answer the same question looking at just 1 sample that is exposed to different manipulations within a factor. That is, 1 factor, k levels only 1 group is compared across k conditions.
10
For normal One-Way ANOVA, we use a different groups to test these a levels. So the observations between treatments are independent. But for One-way RM ANOVA, we use only one group to test these a levels. So the observations between treatments are dependent.
11
Compared with One-Way ANOVA
MODEL: Yij= μi+εij μi: the mean of the ith treatment. εij: the random error which follows N(0,σow2)
12
Compared with One-Way ANOVA
MODEL: Yij= μi+Bj+ε’ij μi: the mean of the ith treatment. Bj: a parameter associated with jth subject which follows N(0,σB2). ε’ij: the random error which follows N(0,σRMOW2) and is independent with Bj
13
Compared with One-Way ANOVA
One-Way ANOVA TABLE Source DF SS MS Treatment a-1 Error N-a σOW2 Total N-1
14
Compared with One-Way ANOVA
One-Way RM ANOVA TABLE Source DF SS MS Treatment a-1 Subject n-1 Error (a-1)(n-1) σRMOW2 Total N-1
15
Compared with One-Way ANOVA
Partition of Sum of Square SSTOTAL SStreatment SSerror Standard ANOVA SSTOTAL SSbetween subject SSwithin subject SSerror Repeated Measures ANOVA SStreatment
16
Compared with paired sample t-test
Example (2 treatments)
17
Compared with paired sample t-test
Hypothesis T-TEST
18
Compared with paired sample t-test
Since So
19
Compared with paired sample t-test
F-TEST
20
Compared with paired sample t-test
F-TEST
21
Compared with paired sample t-test
The paired sample t-test is just the One-way Repeated measures design. Repeated measures design are considered an extension of the paired sample t-test when comparisons between more than two repeated measures are needed.
22
one-way repeated measure ANOVA
Repeated measures one-way ANOVA compares the means of two or more matched groups. When to use? repeated measures ANOVA is used when all members of a random sample are measured under a number of different conditions resources:
23
one-way repeated measure ANOVA
Model Yij = μi +Sj+εij μi = The fixed effect . Sj= The random effect of subject j . εij = The random error independent of Sj . Assumptions: subjects are independent assumes that the random component follows a Gaussian distribution and that the standard deviation does not vary between individuals (rows) or treatments (columns). While this assumption is not too important with large samples, it can be important with small sample sizes the random error truly is random This assumption is called circularityor sphericity. It is closely related to another term you may encounter, compound symmetry.
24
one-way repeated measure ANOVA
Repeated Measures ANOVA Table SS Df MS F Between ( 𝑎 𝑖𝑗 ) 2 𝑠 − 𝑇 2 𝑁 a-1 MSA= 𝑆𝑆𝐴 𝑎−1 F= 𝑀𝑆𝐴 𝑀𝑆𝐸 Within 𝑎 𝑖𝑗 2 − ( 𝑎 𝑖𝑗 ) 2 𝑠 N-a -Subjects ( 𝑆 𝐼 ) 2 𝑎 − 𝑇 2 𝑁 s-1 -Error 𝑆𝑆 𝑤𝑖𝑛𝑡𝑖𝑛 − 𝑆𝑆 𝑠𝑢𝑏𝑗𝑒𝑐𝑡𝑠 MSE= 𝑆𝑆𝐸 (𝑎−1)(𝑠−1) Total 𝑆𝑆 𝑏𝑒𝑡𝑒𝑤𝑤𝑛 + 𝑆𝑆 𝑤𝑖𝑡ℎ𝑖𝑛𝑔 N-1 A sample member is called a subject. When a dependent variable is measured repeatedly for all sample members across a set of conditions, this set of conditions is called a within-subjects factor. The conditions that constitute this type of factor are called trials. When a dependent variable is measured on independent groups of sample members, where each group is exposed to a different condition, the set of conditions is called a between-subjects factor. The conditions that constitute this factor type are called groups. When an analysis has both within-subjects factors and between subjects factors, it is called a repeated measures ANOVA with between-subjects factors.
25
one-way repeated measure ANOVA
Example: We have four drugs (1,2,3 and 4) that relieve pain. Each subject is given each of the four drugs. The subject’s pain tolerance is then measured. Enough time is allowed to pass between successive drug administrations so that we can be sure there’s no residual effect from the previous drug. Are there any difference between the four drugs using significant level 𝛼=0.05?data from the pain experiment: 𝐻0:𝜇1=𝜇2=𝜇3=𝜇4 𝐻𝑎:𝐻0 𝑖𝑠 𝑛𝑜𝑡 𝑎𝑙𝑙 𝑒𝑞𝑢𝑎𝑙 SUBJECT DRUG1 DRUG2 DRUG3 DRUG41 1 5 9 6 11 2 7 12 8 3 10 14 4
26
one-way repeated measure ANOVA
SUBJECT DRUG1 DRUG2 DRUG3 DRUG41 1 5 9 6 11 2 7 12 8 3 10 14 4 Degrees of Freedom Total N= Treatment I= Subject R=4 𝑑𝑓 𝑏𝑒𝑡𝑤𝑒𝑒𝑛 =𝐼−1=4−1=3 𝑑𝑓 𝑊𝑖𝑡ℎ𝑖𝑛 = 𝑑𝑓 𝐸𝑟𝑟𝑜𝑟 + 𝑑𝑓 𝑠𝑢𝑏𝑗𝑒𝑐𝑡 =3−9=12 𝑑𝑓 𝑠𝑢𝑏𝑗𝑒𝑐𝑡 =𝑅−1=4−1=3 𝑑𝑓 𝐸𝑟𝑟𝑜𝑟 = 𝐼 −1 ∗(𝑅 −1)=3 * 3=9 𝑑𝑓 𝑡𝑜𝑡𝑎𝑙 =𝑁−1=16−1=15
27
one-way repeated measure ANOVA
SUBJECT DRUG1 DRUG2 DRUG3 DRUG4 Y.j 1 5 9 6 11 7.75 2 7 12 8 3 10 14 11.75 4 Yi. 6.5 10.25 7.25 10.5 Y..=8.625 SS Treatment =R× ∑(Yi. − Y..)2= 4 × =50.25 SS Subject = I × ∑(Y.j − Y..)2= 4 × = 70.25 SS Total = ∑ ∑(Yij − Y..) 2=133.75 SS Error = ∑ ∑(Yij − Yi. − Y.j + Y..)2 = SS Total − SS Treatment − SS Subject = 13.25
28
one-way repeated measure ANOVA
SUBJECT DRUG1 DRUG2 DRUG3 DRUG4 Y.j 1 5 9 6 11 7.75 2 7 12 8 3 10 14 11.75 4 Yi. 6.5 10.25 7.25 10.5 Y..=8.625 Test Statistic: 𝐹 0 = 𝑀𝑆 𝑏𝑒𝑡𝑤𝑒𝑒𝑛 𝑀𝑆 𝑒𝑟𝑟𝑜𝑟 = (𝑆𝑆 𝑏𝑒𝑡𝑤𝑒𝑒𝑛 ) 𝑑𝑓 𝑏𝑒𝑡𝑤𝑒𝑒𝑛 𝑆𝑆 𝑒𝑟𝑟𝑜𝑟 𝑑𝑓 𝑒𝑟𝑟𝑜𝑒 = ≃ Critical Region: 𝐼𝑓 𝐹 0 𝑖𝑠 𝑔𝑟𝑒𝑎𝑡𝑒𝑟 𝑡ℎ𝑎𝑛 𝐹 3,9, =5.08, 𝑟𝑒𝑗𝑒𝑐𝑡 𝑛𝑢𝑙𝑙 ℎ𝑦𝑝𝑜𝑡ℎ𝑒𝑠𝑖𝑠. Now, the 𝐹 0 = >5.08. 𝑇ℎ𝑒𝑟𝑒𝑓𝑜𝑟𝑒, 𝑤𝑒 𝑟𝑒𝑗𝑒𝑐𝑡 𝐻 0 𝑡ℎ𝑎𝑡 𝑚𝑒𝑎𝑛𝑠 𝑡ℎ𝑒 𝑓𝑜𝑢𝑟 𝑑𝑟𝑢𝑔𝑠 𝑎𝑟𝑒 𝑑𝑖𝑓𝑓𝑒𝑟𝑒𝑛𝑡 𝑢𝑠𝑖𝑛𝑔 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑙𝑒𝑣𝑒𝑙 𝛼=0.05.
29
one-way repeated measure ANOVA
SAS Code data pain; input do drug = 1 to 4 ; input output; end; datalines; ; proc anova data = pain; title'one-way Repeatede Measures ANOVA'; class subj drug; model pain = subj drug; means drug/duncan; run;
30
one-way repeated measure ANOVA
SAS output:
31
Two –factor experiments with a repeated measure on one factor
Qichao Sun
32
Why do we need the two-factor ANOVA with a repeated measure on one factor?
1)mean scores in each treatment group change over two or more time points. 2)under two or more different conditions, there are differences in mean scores in one treatment group.
33
Example To investigate the effect of the drug, which needs several hours to have effects on patients. There are four groups with different dose of drug. Obviously, we cannot be sure if the effects are caused by the dose (maybe time has an effect). So we add the other factor ‘time’, and measure the observation before and after the treatment. Subject Before After Control Group (placebo) 1 80 83 2 85 86 3 88 Treatment Group 2 ( 1.00mg) 4 82 94 5 87 93 6 84 98 Treatment Group 3 ( 1.25mg) 7 102 8 9 97 Treatment Group 4 ( 1.50mg) 10 107 11 103 12 106
34
In this example, we have two factors, the dose of the drug and the time. Here we call the dose Factor A and the time Factor B. And we use the same subjects in one level of Factor A before and after the treatment. So Factor B ‘time’ is the factor with repeated measure. This setting is two factor ANOVA with repeated measure on one factor. The appropriate error term for the test of the dose is subject|dose. The appropriate error term for time and time*dose is time*subject|dose (which is the residual error since we do not include the term in the model).
35
Model 𝑌 𝑖𝑗𝑘 =𝜇+ 𝛼 𝑖 + 𝛽 𝑗 + 𝛼𝛽 𝑖𝑗 + 𝛾 𝑘(𝑖) + 𝜀 𝑖𝑗𝑘
𝑌 𝑖𝑗𝑘 =𝜇+ 𝛼 𝑖 + 𝛽 𝑗 + 𝛼𝛽 𝑖𝑗 + 𝛾 𝑘(𝑖) + 𝜀 𝑖𝑗𝑘 𝑌 𝑖𝑗𝑘 The observation of the kth subject in the ith level of the dose before the treatment (j=1) or after the treatment (j=2). 𝜇 Overall mean 𝛼 𝑖 Main fixed effect of the dose in the ith level ( 𝑖=1 𝐼 𝛼 𝑖 =0. 𝑖=1,2,3,4 ) 𝛽 𝑗 Main fixed effect of the time in the jth time point ( 𝑗=1 𝐽 𝛽 𝑗 =0 ) 𝛼𝛽 𝑖𝑗 fixed Interaction effect of dose in the ith level and the time in jth time point ( 𝛼𝛽 𝑖𝑗 =0) 𝛾 𝑘(𝑖) random effect of the kth subject nested in dose from ith level, which follows 𝑁(0, 𝜎 𝑏 2 ) 𝜀 𝑖𝑗𝑘 Error term, which follows 𝑁(0, 𝜎 2 )
36
Hypothesis Main effect of Factor A ‘dose’
Main effect of factor B ‘time’ 𝐻 0B : 𝛽 1 = 𝛽 2 = 𝛽 3 =…= 𝛽 𝐽 𝐻 0𝑎 : 𝐻 0 𝑖𝑠 𝑛𝑜𝑡 𝑡𝑟𝑢𝑒 Interaction effect of A and B (dose*time) 𝐻 0AB : 𝛼𝛽 11 = 𝛼𝛽 12 = 𝛼𝛽 13 =…= 𝛼𝛽 𝐼𝐽 𝐻 0𝑎 : 𝐻 0 𝑖𝑠 𝑛𝑜𝑡 𝑡𝑟𝑢𝑒
37
ANOVA Table subject|dose Source DF SS MS F Factor A Dose I-1=3 SSA
SSA/(I-1) MSA MSWA Factor B Time J-1=1 SSB SSB/(J-1) MSB MSE AB Interaction Time*Dose (I-1)(J-1)=3 SSAB SSAB/(I-1)(J-1) MSAB MSE Subjects within A subject|dose I(K-1)=8 SSWA SSWA/I(K-1) Error I(J-1)(K-1)=8 SSE SSE/I(J-1)(K-1) Total IJK-1 SST , where I=4, J=2, K=3
38
Sum of Square Dose: SSA=JK ( Y i.. − Y ) 2
Time point: SSB=IK ( Y .j. − Y ) 2 Dose×subject: SSAB=K ( Y ij. − Y .j. − Y i.. + Y ) 2 Error due to subjects within Dose (subject|dose): SSWA=J ( Y i.k − Y i.. ) 2 Error: SSE= ( Y ijk − Y ij. − Y i.k + Y i.. ) 2 SST= Y ijk − Y 2
39
Test statistic 𝐹 𝐴 = 𝑀𝑆𝐴 𝑀𝑆𝑊𝐴 ~ 𝐹 𝐼−1 ,𝐼(𝐾−1)
𝐹 𝐴 = 𝑀𝑆𝐴 𝑀𝑆𝑊𝐴 ~ 𝐹 𝐼−1 ,𝐼(𝐾−1) If F A > F I−1 ,I K−1 ,α , Factor A ‘dose’ is significant. 𝐹 𝐵 = 𝑀𝑆𝐵 𝑀𝑆𝐸 ~ 𝐹 𝐽−1 ,𝐼(𝐽−1)(𝐾−1) If F B > 𝐹 𝐽−1 ,𝐼 𝐽−1 𝐾−1 ,𝛼 , Factor B ‘time’ is significant. F AB = MSAB MSE ~ 𝐹 𝐼−1 𝐽−1 ,𝐼(𝐽−1)(𝐾−1) If F AB > 𝐹 𝐼−1 𝐽−1 ,𝐼 𝐽−1 𝐾−1 ,𝛼 , Factor AB ‘dose*time’ is significant.
40
The SAS code is following.
data drug; input subj dose $ before after; datalines; 1 C 80 83 2 C 85 86 3 C 83 88 4 T 5 T 6 T 7 T 8 T 9 T 10 T 11 T 12 T ; proc anova data= drug; class dose; model before after= dose / nouni; repeated time 2 (0 1); means dose; run;
41
SAS Output for repeated statement
MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no time Effect H = Anova SSCP Matrix for time E = Error SSCP Matrix S=1 M=-0.5 N=3 Statistic Value F Value Num DF Den DF Pr > F Wilks' Lambda 204.49 1 8 <.0001 Pillai's Trace Hotelling-Lawley Trace Roy's Greatest Root MANOVA Test Criteria and Exact F Statistics for the Hypothesis of no time*dose Effect H = Anova SSCP Matrix for time*dose E = Error SSCP Matrix S=1 M=0.5 N=3 Statistic Value F Value Num DF Den DF Pr > F Wilks' Lambda 18.09 3 8 0.0006 Pillai's Trace Hotelling-Lawley Trace Roy's Greatest Root
42
How to choose Multivariate statistics?
The output shows that there are four F statistics: Wilks’ Lambda Pillai’s Trace Hotelling- Lawley Trace Roy’s Greatest Root If there are only very small differences among the P-values, we can either of them or choose Wilks’ Lambda which is often appropriate. If not, find consultant.
43
The ANOVA Procedure Repeated Measures Analysis of Variance Tests of Hypotheses for Between Subjects Effects Source DF Anova SS Mean Square F Value Pr > F dose 3 15.59 0.0011 Error 8 The ANOVA Procedure Repeated Measures Analysis of Variance Univariate Tests of Hypotheses for Within Subject Effects Source DF Anova SS Mean Square F Value Pr > F time 1 204.49 <.0001 time*dose 3 18.09 0.0006 Error(time) 8 Therefore, we can conclude that the dose, Time effects and their interaction are significant at 𝛼=0.05 .
44
The Other method without using repeated statement
Two-factor ANOVA without using the REPEATED statement SAS code: data twoway; set drug; /* ‘SET’ causes observations to be read from the original data set*/ length time $ 7; /*set the length of variable ‘Time’*/ time = ‘before’; /*creat a new variable ‘Time’ and set the value of Time to ‘before’*/ score =before; /*creat a new variable ‘Score’ equl to the before value*/ output; /*the first observation in data set TWOWAY*/ time = ‘after’; score = after; output; keep subj dose time score; run;
45
proc anova data=twoway; class subj dose time; model score = dose subj(dose) time dose*time time*subj(dose); /*In the model statement, all sources of variation are included, so SSE will be 0.*/ means dose|time; test H=dose E=subj(dose); test H=time dose*time E=time*subj(dose); /*the error term for dose is subj(dose), and the error term for time and dose*time is time*subj(dose).*/ run;
46
Output for the method without repeated statement
The ANOVA Procedure Output for the method without repeated statement Class Level Information Class Levels Values subj 12 dose 4 C T2 T3 T4 time 2 after before Source DF Sum of Squares Mean Square F Value Pr > F Model 23 . Error Corrected Total Model statement contains all sources of variation about the grand mean. So SSE is 0. Source DF Anova SS Mean Square F Value Pr > F dose 3 . subj(dose) 8 time 1 dose*time subj*time(dose)
47
Level of dose N score Mean Std Dev C 6 T2 T3 T4 Level of group Level of time N score Mean Std Dev C post 3 pre T The effect of the dose, the time and their interaction are significant at 𝛼=0.05 . Tests of Hypotheses Using the Anova MS for subj(dose) as an Error Term Source DF Anova SS Mean Square F Value Pr > F dose 3 15.59 0.0011 Tests of Hypotheses Using the Anova MS for subj*time(dose) as an Error Term Source DF Anova SS Mean Square F Value Pr > F time 1 204.49 <.0001 dose*time 3 18.09 0.0006
48
Two-Factor ANOVA with Repeated Measures on both Factors Jixiang Zhang
11/11/2018
49
The model is This design is similar to the previous design except that each subject is measured under all levels of both factor.
50
𝛼 𝑗 :Main effect of factor A subject to
𝑌 𝑖𝑗𝑘 :The observation taken at the kth time point from jth group in the ith subject 𝛼 𝑗 :Main effect of factor A subject to 𝛽 𝑘 :Main effect of factor A subject to (𝛼𝛽) 𝑗𝑘 :Interaction effect of factor A and B 𝛿 𝑖 :Main effect of subjects~ 𝛾 𝑖𝑗 :Interaction effect of subjects and factor A~ 𝜂 𝑖𝑘 :Interaction effect of subjects and factor B~ 𝜀 𝑖𝑗𝑘 :Error term~
51
ANOVA TABLE Source DF SS MS F Subjects n-1 SSS SSS/I-1 MSS/MSE
Factor A a-1 SSA SSA/(a-1) MSA/MSA*S ~ F(a-1),(n-1)(a-1) Factor B b-1 SSB SSB/(b-1) MSB/MSB*S ~ F(b-1),(n-1)(b-1) AB Interaction (a-1)(b-1) SSAB SSAB/((a-1)(b-1)) MSAB/MSE~F(a-1)(b-1),(n-1)(a-1)(b-1) A*Subjects (n-1)(a-1) SSA*S SSWA/((n-1)a) SSA*S/MSE F(a-1)(n-1),(n-1)(a-1)(b-1) B*Subjects (n-1)(b-1) SSB*S SSWB/((n-1)b) F(n-1)(b-1),(n-1)(a-1)(b-1) Error (n-a)(a-1)(b-1) SSE SSE/((n-1)(a-1)(b-1)) Total nab-1 SST
52
Example: A group of subjects is treated in the morning and afternoon of two different days. On one of the days, the subjects receive a strong sleeping aid the night before the experiment is to be conducted; on the other, a placebo.
53
A diagram of the experiment
Treatment Control Drug Time Subject Reaction A.M. 1 65 70 2 72 78 3 90 97 P.M 55 60 64 68 80 85
54
We would like to see if the drug had any effect on the reaction time and if the effect was the same for the whole day. We can use the AM/PM measurements on the control day as a comparison for the AM/PM changes on the drug days. Since each subject is measured under all levels of treatment(PLACEBO or DRUG) and TIME(AM/PM), we can treat this experiment as a SUBJ by TREATMENT by TIME factorial design. However, we must specify the error terms to test our hypotheses.
55
In any design where all factors are repeated, such as this one, we can treat the SUBJ variable as being crossed by all other factors. However, by including the SUBJ term in our model, the error term will be zero. The error terms to test each hypothesis are simpler to remember: For factor X, the error term is SUBJ*X.
56
SAS CODE proc anova data=repeat; model react1-react4= /nouni;
input react1-react4; datalines; ; Run; proc anova data=repeat; model react1-react4= /nouni; repeated time 2, treat 2 /nom; run;
57
A portion of output from SAS
58
Interpretation According to the observed p-values, The drug increase reaction time(F=256.00,P=.0039) Reaction time is longer in the morning compared to the afternoon(F=300.00,P=.0033) The interaction of treat and time is not significant(F=4.00,P=0.1835)
59
Three-factor Experiments with a repeated measure
Zishan Chen
60
ANOVA Table Factor A a-1 SSA MSA=SSA/(a-1) Factor B b-1 SSB
Source d.f SS MS Factor A a-1 SSA MSA=SSA/(a-1) Factor B b-1 SSB MSB=SSB/(b-1) Factor C(repeated) c-1 SSC MSC=SSC/(c-1) Subjects(within AB) ab(i-1) SSWAB MSWAB= SSWAB/(ab(i-1)) AB interaction (a-1)(b-1) SSAB MSAB =SSAB/(a-1)(b-1) AC interaction (a-1)(c-1) SSAC MSAC = SSAC/(a-1)(c-1) BC interaction (b-1)(c-1) SSBC MSBC = SSBC/(b-1)(c-1) ABC interaction (a-1)(b-1) (c-1) SSABC MSABC = SSABC/(a-1)(b-1) (c-1) Error ab(c-1)(i-1) SSE MSE = SSE/ab(c-1)(i-1) Total Abci-1 SST
61
Example There is a marketing experiment.
Male and female subjects are offered one of three different brands of coffee: A, B, C. Each brand is tasted twice. After breakfast and After dinner. The preference of each brand is measured on a scale from 1 to 10
62
The results of the experiment
Brand A B C SUBJ Brkfs Dinner Brkfst GENDER M 1 7 8 4 6 13 9 2 3 5 14 15 F 10 16 11 17 12 18 BRAND and GENDER are crossed MEAL: Repeated Measure Factor
63
The SAS code data coffee; input subj brand $ gender $ score_B score_D;
datalines; 1 A M 7 8 2 A M 6 7 3 A M 6 8 4 A F 5 7 5 A F 4 7 6 A F 4 6 7 B M 4 6 8 B M 3 5 9 B M 3 5 10 B F 3 4 11 B F 4 4 12 B F 2 3 13 C M 8 9 14 C M 6 9 15 C M 5 8 16 C F 6 9 17 C F 6 9 18 C F 7 8 ;
64
THE SAS CODE proc anova data=coffee; title "coffee study";
“nouni” means that we do not want univariate statistics for score_b and score_d proc anova data=coffee; title "coffee study"; class brand gender; model score_b score_d = brand | gender / nouni; repeated meal; means brand | gender; run; “brand | gender” meams brand + gender+brand *gender
65
Selected output 1
66
Selected output 2
67
Selected output 3
68
Selected output 4
69
Three-Factor Experiments With Repeated Measures on Two Factors
71
To test these ideas, the following experiment was devised:
A group of high- and low-SES children is selected for the experiment. Their reading comprehension is tested each spring and fall for three consecutive years. A Diagram of the design is shown below:
72
Notice that each subject is measured each spring and fall of each year so that the variables SEASON and YEAR are both repeated measures factors. To analyze this experiment, we will use the SAS program: the REPEATED statement of PROC ANOVA: DATA READ INPUT SUBJ SES $ READ1 READ2 READ3 READ4 READ5 READ6; LABEL READ1 = ' SPRING YR 1 ' READ2 = ' FALL YR 1 ' READ3 = ' SPRING YR 2 ' READ4 = ' FALL YR 2 ' READ5 = ' SPRING YR 3 ' READ6 = ' FALL YR 3 ';
73
DATALINES; 1 HIGH 2 HIGH 3 HIGH 4 HIGH 5 HIGH 6 LOW 7 LOW 8 LOW 9 LOW 10 LOW ; PROC ANOVA DATA=READ; TITLE "READING COMPREHENSION ANALYSIS"; CLASS SES; MODEL READ1-READ6 = SES / NOUNI; REPEATED YEAR 3, SEASON 2; MEANS SES; RUN;
74
Since the REPEATED statement is confusing when we have more than one repeated factor, it is important for you to know how to determine the order of the factor names. Look at the REPEATED statement in this example: REPEATED YEAR 3, SEASON 2; This statement instructs the ANOVA procedure to choose the first level of YEAR(1), then loop through two levels of SEASON(SPRING FALL), then return to the next level of YEAR(2), followed by two levels of SEASON, etc.
78
High-SES student have higher reading comprehension scores than low-SES students (F=13.54, p=0.0062).
Reading comprehension increases with each year (F=26.91, p=0.0001). Students had higher reading comprehension scores in the spring compared to the following fall (F=224.82, p=0.0001) The "slippage" was greater for the low-SES students (there was a significant SES*SEASON interaction [F=37.05, p=0.0003}). "Slippage" decreases as the students get older (YEAR*SEASON is significant [F=112.95, p=0.0001]).
79
Independent Measures Design vs. Repeated Measures Design in ANOVA
80
Experimental design is a method of assigning observations to different groups in an experiment.
Independent-measures design means that there is a separate sample for each of the treatments being compared. Assume the data are independent. Repeated-measures design means that the same sample is tested in all of the different treatments. Data are not independent.
81
Independent measures ANOVA: an extension of the pooled variance t-test
Repeated Measures ANOVA: an extension of the paired sample t-test A t-test has more odds of committing an error the more means are used. Thus, the t-test is used when determining if two averages or means are the same or different. The ANOVA is preferred if comparing three or more averages or means.
82
Independent Measures Design
Advantage: Avoid order effects Disadvantages: Much more time-consuming; The difference between observations such as age, sex, etc. may interfere.
83
Repeated Measures Design
Advantages: Limited number of subjects Less variability Longitudinal analysis Disadvantage: Order effects
84
Repeated Measures Design
Solution: Counterbalancing Counterbalancing means alternating the order of the conditions. It helps researchers to make sure that practice effects are distributed equally across the conditions. Condition 1 Condition 2 Remarks Group A Group A1 Group A2 A performs Condition 1 first Group B Group B2 Group B1 B performs Condition 1 first
85
Acknowledgements http://en.wikipedia.org/wiki/Repeated_measures_design
APPLIED STATISTICS AND THE SAS PROGRAMMING LANGUAGE
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.