Skip to content
Prev 106348 / 398506 Next

A question on lmer() function

On 12/17/06, Guojing Yang <Guojing.Yang at cdu.edu.au> wrote:
I'm not exactly sure what you want to do here but you definitely
should not have location as a fixed-effects term and a random effects
term of the form (1|location).  Such terms would be confounded.

I think the models you want to fit would all have an (implicit)
intercept and a log(N) term in the fixed effects.  They would differ
in terms of whether you have a random effect for the intercept by
location and/or a random effect for the slope with respect to log(N)
by location.  Four variants are

#  random effects for intercept only
lmer(r ~ log(N) + (1|location))

# random effects for slope only
lmer(r ~ log(N) + (0+log(N)|location))

# possibly correlated random effects for intercept and slope
lmer(r ~ log(N) + (log(N)|location))

# independent random effects for intercept and slope
lmer(r ~ log(N) + (1|location) + (0+log(N)|location))