[R-sig-ME] modelling a nested student-school-district model

Douglas Bates bates at stat.wisc.edu
Tue Mar 31 23:29:23 CEST 2009

2009/3/31 chenlei <chenlei at ibcas.ac.cn>:
> Dear all and dr.Bates,

>   I have a dataset with students nested in schools and also schools belong
> to each district. The data was explicitly nested as previous examples.
>   In my case, I don't care the variance between schools or district,and I
> just want to assess the effect of gender on stuedents'
> scores,traditionally,the model can be specified in lmer like :
>   lmer(score~gender+(1|district/school),data)
>    notes: the gender was a factor(male,female)

> in my study ,I want to know the variance between genders,and I also use some
> covariates at gender level to explain the variance between genders.

It doesn't make sense to me to model the effect of gender as a random
effect.  I think of random effects as being associated with particular
experimental or observational units.  On the other hand, the levels of
gender, male and female, are fixed.  This type of factor is the
archetypal example of a factor for which you would use fixed effects.
In particular, you will only have two levels of gender, even if you
consider more schools or districts.  Trying to estimate a variance
from a single contrast is difficult.

>  I construct the unconditional model and conditional models like these:
>   unconditional model :lmer(score~1+(1|gender)+(1/district/school),data)
>   conditional model :lmer(score~1+IQ+(1|gender)+(1/district/school),data)
>   the IQ indicates the mean IQ scores for different genders.

> What I want to confirm is whether the specification of all the models was
> reasonable and correct in lmer.Thanks.
> yours,
> Lei Chen

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