[R] Hierarchical Linear Model using lme4's lmer
Douglas Bates
bates at stat.wisc.edu
Sat Jan 16 15:41:18 CET 2010
On Sat, Jan 16, 2010 at 8:20 AM, Walmes Zeviani
<walmeszeviani at hotmail.com> wrote:
>
> Doug,
>
> It appears you are mixing nlme and lme4 formulation type.
> On nlme library you type
>
> lme(y~x, random=~1|subjetc)
>
> On lme4 library you type
>
> lmer(y~x+(1|subject))
>
> You mixed them.
>
> At your disposal.
Which is what I tell my wife when I am standing by our sink.
> Walmes.
>
>
> Doug Adams wrote:
>>
>> Hi,
>>
>> I was wondering: I've got a dataset where I've got student 'project's
>> nested within 'school's, and 'division' (elementary, junior, or
>> senior) at the student project level. (Division is at the student
>> level and not nested within schools because some students are
>> registered as juniors & others as seniors within the same school.)
>>
>> So schools are random, division is fixed, and the student Score is the
>> outcome variable. This is what I've tried:
>>
>> lmer(data=Age6m, Score ~ division + (1|school), random=~1 | school)
>>
>> Am I on the right track? Thanks everyone, :)
>>
>> Doug Adams
>> MStat Student
>> University of Utah
Walmes is correct that this is mixing two formulations of the model.
It turns out that the model will be fit correctly anyway. The lmer
function has a ... argument which will silently swallow the argument
random = ~ 1|school and ignore it. Looks like we should add a check
for specification of a random argument and provide a warning if it is
present.
More information about the R-help
mailing list