[R-sig-ME] Specifying random effects in lme()

Mike Dunbar mdu at ceh.ac.uk
Wed May 9 17:05:43 CEST 2007


I don't know the answer to your question, but it may not be possible. If it is possible to specify it, then you may still run into problems fitting it. You're trying to fit quite a complex model here with two random slopes and an AR term, are you really sure your model needs to be that complicated? 

Can you fit the lmer model you mention? If so, is there evidence for autocorrelation of residuals?



>>> Gavin Simpson <gavin.simpson at ucl.ac.uk> 09/05/2007 14:23 >>>
Dear List,

I am modelling repeated measures data from 11 sites in the UK using
lme() from the nlme package. I have the following call for a random
intercept model with an AR1 error structure:

mod <- lme(doc ~ temp + log.so4 + log.cl, random = ~ 1 | site,
           correlation = corAR1(), data = hydro)

I would like to fit a model that has random effects for log.so4 and
log.cl within site, so that I am fitting a random slop and intercept
model --- we want the effect of log.so4 and log.cl to vary between sites
and to compare the fits of the two models.

If I am following lmer() in lme4 correctly, I believe I could fit this
model as:

hydro.lmer <- lmer(doc ~ temp + log.so4 + log.cl +
                   (log.so4 | site) + (log.cl | site),
                   data = hydro)

but without the AR1 correlation.

I am struggling to get the syntax correct for random in lme() to add
random effects to log.so4 and log.cl. I have only managed to get a model
where one of the coefficients (log.cl) also has a random effect.

I would be most grateful if someone could explain how to fit the model
in lme() by showing me the correct form for the random argument.

Many thanks,


 Gavin Simpson                 [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/ 
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk 

R-sig-mixed-models at r-project.org mailing list

This message (and any attachments) is for the recipient only...{{dropped}}

More information about the R-sig-mixed-models mailing list