[R] advise for modeling a linear mixed model

Jason Turner jasont at indigoindustrial.co.nz
Sat Aug 23 08:22:32 CEST 2003

Frank Mattes wrote:
> Dear R help-list reader,
> I'm trying to investigate my data with linear mixed model and are 
> seeking advise how to write the model in R. I was trying to get hold of 
> the recommended book from Bates et al, but neither the major bookshop 
> nor our university library had the book.

Is gated a continuous variable?  You could compare it as...

(gated as fixed effect)

lme(freq ~ day*group + gated, random = ~day | ID data=frame,
   method = "ML")


(gated as random effect)

lme(freq ~ day*group, random = ~day + gated | ID data=frame,
   method = "ML")

and use anova() to compare.  Note that you'll need the "ML" as opposed 
to REML to compare using anova.

Or have I missed something?

check out ?corClasses, too, to help with correlated error terms.

As for the book, Bates & Pinheiro, I'm working my way slowly through it, 
and it's well worth it.  Well written, and very informative.  The 
"slowly" working through it is because my spare time is very short these 
days.  I strongly urge you to purchase it from your favorite on-line 
book retailer (or pop by Foyles to grab one - just a couple blocks up 
from Charring Cross station, if memory serves).

In the mean time, if you can't immediately grab a copy, go over here:


and select "S-PLUS 6 Guide to Statistics (Part I)", and read the chapter 
on Linear and Non-Linear Mixed-effects models (Chapter 14 in my copy). 
I've got this, and a copy of Bates & Pinheiro.  The free guide isn't 
bad, B&P is excellent.


Indigo Industrial Controls Ltd.
jasont at indigoindustrial.co.nz

More information about the R-help mailing list