library(MASS) # this is included the standard R distribution library(SMPracticals) # this has various data sets from Davison's book library(ellipse) # but I got an error the first time and had to download an additional package library(SMPracticals) # and now it works data(rat.growth) # for Example 9.18 rat.growth[1:10,] # to see what it looks like, and to see variable names with(rat.growth, plot( y ~ week , type="l")) separate.lm = lm(y ~ week + factor(rat)+ week:factor(rat), data = rat.growth) # fit separate linear models to each set of 5 observations rat.mixed = lmer(y ~ week + (week|rat), data = rat.growth) # REML is the default summary(rat.mixed) # compare Table 9.28