#Repeated measures Example library(nlme) #help(ergoStool) #Devore (2000) cites data from an article in _Ergometrics_ (1993, #pp. 519-535) on ``The Effects of a Pneumatic Stool and a #One-Legged Stool on Lower Limb Joint Load and Muscular Activity.'' #This data frame contains the following columns: # # effort a numeric vector giving the effort (Borg scale) required to # arise from a stool. # # Type a factor with levels 'T1', 'T2', 'T3', and 'T4' giving the # stool type. # # Subject an ordered factor giving a unique identifier for the # subject in the experiment. ergoStool pdf("ergoplots.pdf") par(pty="s") plot(ergoStool) #visually compare magnitude of the effects of Type and Subject factors plot.design(ergoStool) fm1 <- lme(effort~Type, data=ergoStool, random=~1 | Subject) anova(fm1) summary(fm1) #examine the fit and residuals intervals(fm1) plot(fm1) qqnorm(resid(fm1)) #for residuals vs fitted values by Subject, also see plot.lme plot(fm1, resid(.)~fitted(.) | Subject, abline=0, lty=2) #for standardized residuals versus fitted values by Subject plot(fm1, resid(., type = "p") ~ fitted(.) | Subject, abline = 0) dev.off()