[R-sig-ME] lmer model specification for nested random effects
Ben Bolker
bbolker at gmail.com
Fri Dec 10 23:24:42 CET 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 10-12-09 11:40 AM, Douglas Bates wrote:
> On Thu, Dec 9, 2010 at 10:22 AM, Gustavo Betini <betinig at uoguelph.ca> wrote:
>> Hi, all,
>
>> I have a dataset with several individuals from different sites measured
>> several times. There are 7 different sites and around 10 individuals
>> from each site. My question is:
>
>> Is this what Douglas Bates call "implicit nesting"? If so, the recommendation is to create a new variable
>
> We would need to see the output of
>
> str(data)
>
> to decide. Assuming that there are around 70 individuals in total,
> the question is whether the id factor has about 70 levels or about 10
> levels. In the second case id is only meaningful within a site and to
> produce unique levels for each individual it is necessary to consider
> the site:id interaction.
>
> But that is not the way that most researchers would organize the data.
> The sensible thing to do is to assign a unique level to each
> individual in which case (1|id) is a suitable specification.
>
>> data<- within(data, {siteid<- factor(site:id)}
>>
I agree that it's sensible and works well with lme4, but I don't know
about "how most researchers would organize the data" -- depends very
much on the researcher/field.
Ben Bolker
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAk0CqKoACgkQc5UpGjwzenPaNgCfUX2uo7l+dErpnR1sx9/o1F0m
JPUAoJEs9wCJbRHn6yCMi5l8a6oRgo44
=m6NY
-----END PGP SIGNATURE-----
More information about the R-sig-mixed-models
mailing list