Description Usage Format Details Note Source References Examples

The data are from a study of exercise therapies, where 37 patients were assigned to one of two weightlifting programs.

1 |

A data frame with 259 observations on the following 4 variables.

`id`

a factor with 37 levels

`treatment`

a factor with levels

`repetitions`

and`weights`

representing whether repetitions or weights were increased, respectively`day`

a numeric vector

`strength`

a numeric vector

In the first program (treatment 1), the number of repetitions was increased as subjects became stronger. In the second program (treatment 2), the number of repetitions was fixed but the amount of weight was increased as subjects became stronger. Measures of strength were taken at baseline (day 0), and on days 2, 4, 6, 8, 10, and 12.

Original variable names have been adapted to R conventions. Data were
reshaped from wide to long format and the response named
`strength`

.

http://biosun1.harvard.edu/~fitzmaur/ala

Freund RJ, Littell RC, Spector PC (1986) SAS Systems for Linear Models, Cary, NC: SAS Institute Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ```
str(exercise)
summary(exercise)
if (require(lattice)) {
xyplot(strength ~ day | treatment, data=exercise, groups=id,
type="l", cex=0.5, col=1,
scales=list(alternating=1, rot=c(0, 1), tck=c(0.5, 0)),
xlab="Time (days)", ylab="Strength",
panel=function(x, y, ...) {
panel.superpose(x, y, ...)
ym <- tapply(y, factor(x), mean, na.rm=TRUE)
panel.xyplot(unique(x), ym, lwd=3, ...)
})
}
if (require(lme4)) {
## Problem 8.1.3
fm1 <- lmer(strength ~ day * treatment + (day | id), data=exercise)
VarCorr(fm1)
fm1ML <- update(fm1, REML=FALSE)
## Problem 8.1.4
fm2 <- lmer(strength ~ day * treatment + (1 | id), data=exercise)
fm2ML <- update(fm2, REML=FALSE)
anova(fm2ML, fm1ML)
## Problem 8.1.5
fixef(fm1); fixef(fm2)
## Problem 8.1.8
coef(fm1)
}
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.