Skip to content
Prev 2326 / 20628 Next

repeated measures OR block with time covariate?

Dear Douglas,  thank you very much for the reply, it is the kind of advice I was looking for.  Regards, Paul


Paul Prew  |  Statistician
651-795-5942?? |?? fax 651-204-7504 
Ecolab Research Center  | Mail Stop ESC-F4412-A 
655 Lone Oak Drive  |  Eagan, MN 55121-1560 

-----Original Message-----
From: dmbates at gmail.com [mailto:dmbates at gmail.com] On Behalf Of Douglas Bates
Sent: Wednesday, May 20, 2009 10:23 AM
To: Prew, Paul
Cc: r-sig-mixed-models at r-project.org
Subject: Re: [R-sig-ME] repeated measures OR block with time covariate?
On Tue, May 19, 2009 at 8:51 PM, Prew, Paul <Paul.Prew at ecolab.com> wrote:
Off the top of my head I would say that using fixed effects for the
blocking factor is a conservative approach and probably the best
approach in terms of simplicity.  I'm assuming that the design is
balanced in that each hospital is observed for the same number of
weeks, in which case the hospital and time effects would be
orthogonal.

With regard to the sums of squares, a model with random effects will
remove a smaller part of the sum of squares than will a model with
fixed effects because the random effects are shrunk relative to the
fixed effects.  Thus the residual sum of squares in a random effects
model will be at least as large as that in a model with fixed-effects
for the hospitals.  Consider the enclosed model fits for the
sleepstudy data.

library(lme4)
(fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy))
summary(fm2 <- lm(Reaction ~ Subject * Days, sleepstudy))
deviance(fm2)  # residual sum of squares for fixed-effects model
fm1 at deviance["wrss"]  # residual sum of squares for mixed model

When run it produces
[1] 94311.5
wrss
98880.24

There are differences in interpretation, of course.  It is a little
more difficult to decide how you would test for a significant
"typical" slope in the fixed-effects model than in the mixed model.
The parameter labeled "Days" in the fixed-effects model is the
estimate of the slope for the first Subject, not a typical subject.

The big advantage of using lm instead of lmer in a situation like this
is that lm gives you p-values and lmer doesn't. :-)
CONFIDENTIALITY NOTICE: =\ \ This e-mail communication a...{{dropped:12}}