An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-help/attachments/20061218/9eff0deb/attachment.pl
A question on lmer() function
2 messages · Guojing Yang, Douglas Bates
1 day later
On 12/17/06, Guojing Yang <Guojing.Yang at cdu.edu.au> wrote:
Dear R users,
We have encountered a slight problem when using the lmer()
function:
1. Data description: 11 locations; Nt: monthly mosquito population
density from 1994-2005 in each location.
2. Question: to examine the degree of spatial heterogeneity in the
system by testing model support for single versus multiple intercepts
and slopes for the location effect. We applied the lmer() function and
introduced location as spatial effect. Four different models were
generated as following:
a. 1 intercept & 1 slope : lmer(r~log(N)+(1|location)), where r <-
log(Nt/Nt-1) and location is a random effect.
b. Multi-intercept & 1 slope: lmer(r~location+log(N)+(1|location))
c. 1 slope & multi-intercept: ??????
d. Multi-intercept & multi-slope:
lmer(r~location*log(N)+(1|location))
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))
As you can see, we have had trouble defining model c. Does anyone know
how to code this using lmer? We really appreciate any response.
Guojing
[[alternative HTML version deleted]]
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.