An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-mixed-models/attachments/20120817/1368b598/attachment.pl>
random effect nested in the fixed effect
3 messages · Li Li, Hans Ekbrand
On Fri, Aug 17, 2012 at 09:39:48PM -0400, li li wrote:
Dear all,
I am starting to use R for mixed models.
For example, for the date below,
I want to fit the model values=sample+ind(sample).
Here "sample" is a fixed effect and "ind"
should be a random effect nested in "sample".
for lme4 I would have tried: lmer(values ~ sample + (sample | ind), data = y)
Hans Ekbrand (http://sociologi.cjb.net) <hans at sociologi.cjb.net>
On Fri, Aug 17, 2012 at 09:39:48PM -0400, li li wrote:
Dear all,
I am starting to use R for mixed models.
For example, for the date below,
I want to fit the model values=sample+ind(sample).
Here "sample" is a fixed effect and "ind"
should be a random effect nested in "sample".
[...]
Here is the data structure: values ind sample 1 0.03325 1 1 2 0.03305 1 1 3 0.03185 1 1 4 0.03515 1 1 5 0.03375 1 1 6 0.01180 1 2 7 0.01850 1 3 8 0.02915 1 4 9 0.06200 1 5 10 0.03230 2 1 11 0.03345 2 1 12 0.03385 2 1 13 0.03605 2 1 14 0.03225 2 1 15 0.01145 2 2 16 0.01805 2 3 17 0.02950 2 4 18 0.05995 2 5
This looks like crossed data. It this really is nested data, then it is implicitly nested as described in http://lme4.r-forge.r-project.org/book/Ch2.pdf, page 39, and my formula will not work. For my formula to work, you have to make samples clearly unique (see page 40 in http://lme4.r-forge.r-project.org/book/Ch2.pdf):
Hans Ekbrand (http://sociologi.cjb.net) <hans at sociologi.cjb.net>