[R-sig-ME] Science Fair data

Douglas Bates bates at stat.wisc.edu
Tue Jan 26 16:41:41 CET 2010


On Mon, Jan 25, 2010 at 9:41 PM, Doug Adams <dougadams53 at gmail.com> wrote:
>> you want ...
>>
>> lmer(score ~ division + (1|district/school), data=Age6m)
>>
>> and not
>>
>> lmer(score ~ division + (1|school|district), data=Age6m)
>>
>>
>> You want school nested within district correct? The first line specifies
>> that. Or maybe you really wanted ...
>>
>> lmer(score ~ division + (1|school + district), data=Age6m)
>
> Thanks; I think that makes sense.

Well, actually it doesn't.  If you tried that it would fail because
there is no addition operator for factors.

> What's the difference between
> listing your factors as:

> lmer(score ~ division + (1|district/school), data=Age6m)

In this model the effects of the district and the school are modeled
with random effects.  The model specification is equivalent to

 lmer(score ~ division + (1|district) + (1|school:district), Age6m)

and, if the levels of school are distinct (i.e. you don't have a
school 1 in both district 1 and district 2 or something like that),
then the specification is equivalent to

lmer(score ~ division + (1|district) + (1|school), Age6m)

> and
> lmer(score ~ division + (1|school) + district, data=Age6m)

In this model the effect of the school is modeled by random effects
but the effect of the district is modeled by fixed-effects parameters.

The choice of fixed effects or random effects depends on the structure
of the data and the type of inferences you wish to make.  If you have
data from only some of the school districts and you wish to form
conclusions about a generic district then random effects are
preferred.  If you have data from all districts and you want to reach
conclusions only about those specific districts then fixed effects are
preferred.  If you want to consider how the variability in the
responses splits into student-to-student variability and
school-to-school variability and district-to-district variability then
random effects are preferred.

>
> since district is another level?  Sorry if that question is quite
> 'newbie.'   : )
>
> Doug
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>




More information about the R-sig-mixed-models mailing list