Repeated Measures o o The term repeated measures

  • Slides: 22
Download presentation
Repeated Measures o o The term repeated measures refers to data sets with multiple

Repeated Measures o o The term repeated measures refers to data sets with multiple measurements of a response variable on the same experimental unit or subject. In repeated measurements designs, we are often concerned with two types of variability: n n o Between-subjects - Variability associated with different groups of subjects who are treated differently (equivalent to between groups effects in one-way ANOVA) Within-subjects - Variability associated with measurements made on an individual subject. Examples of Repeated Measures designs: A. B. C. Two groups of subjects treated with different drugs for whom responses are measured at six -hour increments for 24 hours. Here, DRUG treatment is the between-subjects factor and TIME is the within-subjects factor. Students in three different statistics classes (taught by different instructors) are given a test with five problems and scores on each problem are recorded separately. Here CLASS is a between-subjects factor and PROBLEM is a within-subjects factor. Volunteer subjects from a linguistics class each listen to 12 sentences produced by 3 text to speech synthesis systems and rate the naturalness of each sentence. This is a completely within-subjects design with factors SENTENCE (1 -12) and SYNTHESIZER.

Repeated Measures o When measures are made over time as in example A we

Repeated Measures o When measures are made over time as in example A we want to assess: n n n o how the dependent measure changes over time independent of treatment (i. e. the main effect of time) how treatments differ independent of time (i. e. , the main effect of treatment) how treatment effects differ at different times (i. e. the treatment by time interaction). Repeated measures require special treatment because: n n Observations made on the same subject are not independent of each other. Adjacent observations in time are likely to be more correlated than non-adjacent observations

Repeated Measures o Methods of repeated measures ANOVA n n n o Univariate -

Repeated Measures o Methods of repeated measures ANOVA n n n o Univariate - Uses a single outcome measure. Multivariate - Uses multiple outcome measures. Mixed Model Analysis - One or more factors (other than subject) are random effects. We will discuss only univariate approach

Repeated Measures A layout of simple repeated measures with three treatments on n subjects.

Repeated Measures A layout of simple repeated measures with three treatments on n subjects. Subjects 1 2 3. . . n Trt 1 y 11 y 21 y 31. . . yn 1 Trt 2 y 12 y 22 y 32. . . yn 2 Trt 3 y 13 y 23 y 33. . . yn 3

Repeated Measures o Assumptions: n n n Subjects are independent. The repeated observations for

Repeated Measures o Assumptions: n n n Subjects are independent. The repeated observations for each subject follows a multivariate normal distribution The correlation between any pair of within subjects levels are equal. This assumption is known as sphericity.

Repeated Measures o o o Test for Sphericity: n Mauchley’s test Violation of sphericity

Repeated Measures o o o Test for Sphericity: n Mauchley’s test Violation of sphericity assumption leads to inflated F statistics and hence inflated type I error. Three common Corrections for violation of sphericity: n Greenhouse-Geisser correction n Huynh-Feldt correction n Lower Bound Correction All these three methods adjust the degrees of freedom using a correction factor called Epsilon lies between 1/k-1 to 1, where k is the number of levels in the within subject factor.

Repeated Measures - SPSS Demo o o Analyze > General Linear model > Repeated

Repeated Measures - SPSS Demo o o Analyze > General Linear model > Repeated Measures Within-Subject Factor Name: e. g. time, Number of Levels: number of measures of the factors, e. g. we have two measurements PLUC. pre and PLUC. post. So, number of level is 2 for our example. > Click on Add Click on Define and select Within-Subjects Variables (time): e. g. PLUC. pre(1) and PLUC. pre(2) Select Between-Subjects Factor(s): e. g. grp

Repeated Measures ANOVA SPSS output:

Repeated Measures ANOVA SPSS output:

Repeated measures ANOVA SPSS output

Repeated measures ANOVA SPSS output

Repeated Measures - R Demo o Arrangement of the data can be done in

Repeated Measures - R Demo o Arrangement of the data can be done in MSExcel. However the following R commands will arrange the data in default. csv for the ANOVA of repeated measuresattach(x) sid 1<- c(sid, sid) grp 1<-c(grp, grp) plc<- c(PLUC. pre, Pluc. post) time<-c(rep(1, 60), rep(2, 60)) o The following code is for repeated measures ANOVA summary(aov(plc~factor(grp 1)*factor(time) + Error(factor(sid 1))))

Repeated Measures R output: Error: factor(sid 1) Df Sum Sq Mean Sq F value

Repeated Measures R output: Error: factor(sid 1) Df Sum Sq Mean Sq F value Pr(>F) factor(grp 1) 2 121. 640 60. 820 16. 328 2. 476 e-06 *** Residuals 57 212. 313 3. 725 --Signif. codes: 0 ‘***’ 0. 001 ‘**’ 0. 01 ‘*’ 0. 05 ‘. ’ 0. 1 ‘ ’ 1 Error: Within Df Sum Sq Mean Sq F value Pr(>F) factor(time) 1 172. 952 33. 8676 2. 835 e-07 *** factor(grp 1): factor(time) 2 46. 818 23. 409 4. 5839 0. 01426 * Residuals 57 291. 083 5. 107 --Signif. codes: 0 ‘***’ 0. 001 ‘**’ 0. 01 ‘*’ 0. 05 ‘. ’ 0. 1 ‘ ’ 1

Odds Ratio o o Statistical analysis of binary responses leads to a conclusion about

Odds Ratio o o Statistical analysis of binary responses leads to a conclusion about two population proportions or probabilities. The odds in favor of an event is the quantity p/1 -p, where p is the probability (proportion) of the event. The odds ratio of an event is the ratio of the odds of the event occurring in one group to the odds of it occurring in another group. Let p 1 be the probability of an event in one group and p 2 be the probability of the same event in the other group. Then the odds ratio,

Odds Ratio Estimating odds ratio in 2 x 2 table Cancer Smokers Non. Smokers

Odds Ratio Estimating odds ratio in 2 x 2 table Cancer Smokers Non. Smokers a c No Cancer b d a+b c+d a+c b+d N=a+b+c+d The odds of cancer among smokers is a/b and the odds of cancer in non-smokers is c/d and the ratio of two odds is,

Odds Ratio o o The odds ratio must be greater than or equal to

Odds Ratio o o The odds ratio must be greater than or equal to zero. As the odds of the first group approaches zero, the odds ratio approaches zero. As the odds of the second group approaches zero, the odds ratio approaches positive infinity An odds ratio of 1 indicates that the condition or event under study is equally likely in both groups. An odds ratio greater than 1 indicates that the condition or event is more likely in the first group. An odds ratio less than 1 indicates that the condition or event is less likely in the first group. Log odds …

Odds Ratio-Demo o MS-Excel: No default function SPSS: Analyze > Descriptive Statistics > Crosstabs

Odds Ratio-Demo o MS-Excel: No default function SPSS: Analyze > Descriptive Statistics > Crosstabs > Select Variables: Row(s): Two groups we want to compare e. g. shades, Column(s): Response variable e. g (pc)> Click on Statistics > Select Risk. R: Odds ratio are calculated from Logistic regression model.

Odds ratio SPSS output:

Odds ratio SPSS output:

Logistic Regression o o Consider a binary response variable Y with two outcomes (1

Logistic Regression o o Consider a binary response variable Y with two outcomes (1 and 0). Let p be the proportion of the event with outcome 1. The logit(p) can be defined as log of odds of the event with outcome 1. Then the logistic regression for the response variable Y on a set of explanatory variables X 1, X 2, …. , Xr can be written as logit(p) = log(p/1 -p)= b 0 +b 1 X 1+ … +br. Xr

Logistic Regression o o From the model of logistic regression, the odds in favor

Logistic Regression o o From the model of logistic regression, the odds in favor of Y=1, (p/1 -p), can be expressed interms of some r independent variables, p/1 -p = exp( b 0 + b 1 X 1 + +br. Xr ) If there is no influence of the explanatory variables (i. e. X 1=0, … Xr =0), the odds in favor of Y=1, (p/1 -p), is exp(b 0). If an independent variable (e. g. X 1 in the model) is categorical with two categories, then exp(b 1) implies the ratio of odds (in favor of Y=1) in two categories of the variable X 1. If an independent variable (e. g. X 2 in the model) is numeric, then exp(b 2) implies the change in odds (p/1 -p) for 1 unit change in X 2.

Logistic Regression-Demo o MS-Excel: No default functions SPSS: Analyze > Regression > Binary Logistic

Logistic Regression-Demo o MS-Excel: No default functions SPSS: Analyze > Regression > Binary Logistic > Select Dependent variable: > Select independent variable (covariate) R: uses the ‘glm’ function for Logistic regression analysis. Codes are in the Routput slide.

Logistic Regression SPSS output

Logistic Regression SPSS output

Logistic Regression SPSS output

Logistic Regression SPSS output

Logistic Regression R output Shades[Shades==2]<-0 > ftc<-glm(pc~Shades, family=binomial(link = "logit")) > summary(ftc) Call: glm(formula

Logistic Regression R output Shades[Shades==2]<-0 > ftc<-glm(pc~Shades, family=binomial(link = "logit")) > summary(ftc) Call: glm(formula = pc ~ Shades, family = binomial(link = "logit")) Deviance Residuals: Min 1 Q -1. 706 e+00 -7. 290 e-01 Median -1. 110 e-16 3 Q 7. 290 e-01 Max 1. 706 e+00 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 1. 1896 0. 4317 2. 756 0. 00585 ** Shades -2. 3792 0. 6105 -3. 897 9. 73 e-05 *** --Signif. codes: 0 ‘***’ 0. 001 ‘**’ 0. 01 ‘*’ 0. 05 ‘. ’ 0. 1 ‘ ’ 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 83. 178 Residual deviance: 65. 193 AIC: 69. 193 on 59 on 58 degrees of freedom Number of Fisher Scoring iterations: 4 > confint(ftc) Waiting for profiling to be done. . . 2. 5 % 97. 5 % (Intercept) 0. 3944505 2. 114422 Shades -3. 6497942 -1. 237172 > exp(ftc$coefficients) (Intercept) Shades 3. 2857143 0. 0926276 > exp(confint(ftc)) Waiting for profiling to be done. . . 2. 5 % 97. 5 % (Intercept) 1. 48356873 8. 2847933 Shades 0. 02599648 0. 2902037 >