Repeated Measures ANOVA

Repeated Measures ANOVA

Repeated Measures ANOVA Prof. Wei Zhu Department of Applied Mathematics & Statistics Stony Brook University 2 The One-way ANOVA we have just learnt can test the equality of several population means. It is an extension of the pooled variance t-test That is: H0 (null hypothesis) : µ1 = µ2 = µ3 =…….. = µk Ha (alternative hypothesis): At least one of means differs from the rest. Assumptions: Unknown but equal population variances Normal populations Independent samples 3 The F statistic k 1 2 k1 ni xi x F i1 k n j 1 2 N k xij xi i1 j1 th th where xij = the j observation in the i sample. i 1,2,,k and j 1,2,,ni ni xij j1 th xi mean for i sample i 1,2,,k ni k ni k xij N n Total sample size i1 j1 i x Overall mean i1 N 4 The ANOVA table Source S.S d.f, M.S. F k 2 k MS 2 B SSB ni xi x 1 F Between k 1 MSB k1 ni xi x i1 MSW i1 k n j k n j Within 2 1 2 SSW xij xi N k MSW N k xij xi i1 j1 i1 j1 The ANOVA table is a tool for displaying the computations for the F test. It is very important when the Between Sample variability is due to two or more factors. We reject the ANOVA null hypothesis of equal means if F > Fk-1,N-k, α 5 Limitations of the one-way ANOVA: The most distinct disadvantage to the analysis of variance (ANOVA) method is that it requires three assumptions to be made: ☼ The samples must be independent to each other. ☼ All variances from each data group, though unknown, must be equal.The normality assumption. 6 7 ☼ A repeated measures design is one in which at least one of the factors consists of repeated measurements on the same subjects or experimental units, under different conditions and/or at different time points. 8 A repeated measures design often involves measuring subjects at different points in time – or subjects measured under different experimental conditions It can be viewed as an extension of the paired-samples t-test (which involved only two related measures) Thus, the measures—unlike in the “regular” ANOVA—are correlated, that is, the observations are not independent 9 Example: Data collected in a sequence of (often) evenly spaced points in time – this is usually referred to as the ‘longitudinal data’ Example: Different treatments are assigned to the each experimental unit 10 By collecting data from the same participants under repeated conditions, the individual differences can be eliminated or reduced as a source of between group differences. Also, the sample size is not divided between conditions or groups and thus inferential testing becomes more powerful. This design also proves to be economical when sample members are difficult to recruit. 11 12 As with any ANOVA, repeated measures ANOVA tests the equality of means. However, repeated measures ANOVA is used when all members of a random sample are measured under a number of different conditions or at different time points. As the sample is exposed to each condition, the measurement of the dependent variable is repeated. Using a standard ANOVA in this case is not appropriate because it fails to model the correlation between the repeated measures: the data violate the ANOVA assumption of independence. 13 The simplest example of a repeated measures design is a paired samples t-test: Each subject is measured twice, for example, time 1 and time 2, on the same variable; or, each pair of matched participants are assigned to two treatment levels. If we observe participants at more than two time-points, then we need to conduct a repeated measures ANOVA. 14 What we would like to do is to decompose the variability into: (1) A random ‘subject’ effect (2) A fixed ‘treatment’ or ‘time’ effect Treating the subject as a random effect has the added advantage that we can extend our conclusion to the population where these subjects were drawn from. 15 Yij = μj +Si+εij μj = The fixed effect, j=1, ⋯,k Si= The random effect of subject i, i=1, ⋯,n εij = The random error independent of Si Furthermore, we set the total number of observations as: N = n*k 16 17 17 18 We will reject the ANOVA null hypothesis if Fk-1,(k-)(n-1) > α 19 20 Assumptions – summary: For a repeated measures design, we start with the same assumptions as a paired samples t-test : Participants are independent and randomly selected from the population Normality Then, very importantly, there are two approaches to repeated measures ANOVA depends on the assumption of the variance-covariance matrix: ☺ the univariate approach (where compound symmetry is imposed), and ☺ the multivariate approach (where no assumption is imposed) 21 Example: Consider the following experiment: 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 is no residual effect from the previous drug. The null hypothesis is: Mean(1)=Mean(2)=Mean(3)=Mean(4) 22 Table: Pain tolerance under 4 different drugs Subject Drug1 Drug2 Drug 3 Drug 4 1 5 9 6 11 2 7 12 8 9 3 11 12 10 14 4 3 8 5 8 23 In the one-way analysis of variance without a repeated measure, we would have each subject receive only one of the four drugs. In this design, each subjects is measured under each of the drug conditions. This has several important advantages as enumerated before. 24 Each subject acts as his own control. i.e. : drugs effects are calculated by recording deviations between each drug score and the average drug score for each subject. The normal subject-to-subject variation can thus be removed from the error sum of squares. 25 26 27 SAS code using the REPEATED Statement DATA REPEAT; INPUT SUBJ PAIN1-PAIN4; DATALINES; 1 5 9 6 11 2 7 12 8 9 3 11 12 10 14 4 3 8 5 8 ; PROC ANOVA DATA=REPEAT; TITLE 'using repeated statement'; MODEL PAIN1-PAIN4 = / NOUNI; REPEATED DRUG 4 (1 2 3 4) / printe; RUN; ☺ Please see Quiz 3 solutions for detailed explanations of the SAS output. 28 SAS code using the REPEATED Statement Remark 1 : about the data set We need the data set in the form: SUBJ PAIN1 PAIN2 PAIN3 PAIN4 NOTICE that it does not have a DRUG variable 29 SAS code using the REPEATED Statement Remark 2 : about the REPEATED Statement The general form: To compute pairwise comparisons REPEATED factor_name CONTRAST(n); •N is a number from 1 to k, with k being # levels of repeated factor; •To get all pairwise contrasts, we need k-1 repeated statements 30 SAS code using the REPEATED Statement Remark 2 : about the REPEATED Statement In our example: Request ANOVA PROC ANOVA DATA=REPEAT; tables for each TITLE 'using repeated statement'; contrast MODEL PAIN1-PAIN4 = / NOUNI; REPEATED DRUG 4 CONTRAST(1) / SUMMARY; REPEATED DRUG 4 CONTRAST(2) / SUMMARY; REPEATED DRUG 4 CONTRAST(3) / SUMMARY; RUN; 31 SAS code using the REPEATED Statement Remark 3 : more explanation of the ANOVA procedure PROC ANOVA DATA=REPEAT; TITLE 'using repeated statement'; MODEL PAIN1-PAIN4 = / NOUNI; REPEATED DRUG 4 (1 2 3 4) / printe; RUN; •No CLASS: our data set does not have an independent variable •NOUNI: not to conduct a separate analysis for each of the four PAIN •4: the repeated factor “DRUG” has four levels; optional •(1 2 3 4): the labels we want printed for each level of DRUG •printe calls for the Machly’s Sphericity Test for compound symmetry 32 SAS code using the REPEATED Statement Remark 4 : Data conversion: the long form & the broad form DATA PAIN; DATA PAIN; INPUT SUBJ @; INPUT SUBJ DRUG The following PAIN; DO DRUG = 1 to 4; INPUT PAIN @; is the data format, DATALINES; the broad form, that 1 1 5 OUTPUT; END; You should master 1 2 9 first. 1 3 6 DATALINES; 1 4 11 1 5 9 6 11 DATA REPEAT; 2 1 7 2 7 12 8 9 INPUT SUBJ PAIN1-PAIN4; 2 2 12 3 11 12 10 14 DATALINES; …… 4 3 8 5 8 1 5 9 6 11 ; ; 2 7 12 8 9 3 11 12 10 14 4 3 8 5 8 ; 33 The long form! DATA PAIN; To keep reading from the same line of data INPUT SUBJ @; DO DRUG = 1 to 4; iterative loop INPUT PAIN @; OUTPUT; END; DATALINES; 1 5 9 6 11 2 7 12 8 9 The broad form! 3 11 12 10 14 4 3 8 5 8 ; Generate data in long form from the broad form 34 SAS: The DO loop the general form: initial ending value value Do variable = start TO end BY increment; (SAS Statements) Default: 1 END; 35 SAS: The DO loop in our example: initial ending value: 1 value: 4 DO DRUG = 1 to 4; INPUT PAIN @; OUTPUT; to keep reading from the same line of data END; return to “DO” 36 Repeated measure / Longitudinal data: broad form id time1 time2 time3 time4 1 31 29 15 26 2 24 28 20 32 3 14 20 28 30 4 38 34 30 34 5 25 29 25 29 6 30 28 16 34 Hypothetical data from Twisk, chapter 3, page 26, table 3.4 37 Jos W.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    90 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us