[R-sig-ME] parameterization for partly nested design with repeated measurements
Douglas Bates
bates at stat.wisc.edu
Sat Nov 13 14:03:10 CET 2010
On Fri, Nov 12, 2010 at 4:28 PM, Kay Cecil Cichini
<Kay.Cichini at uibk.ac.at> wrote:
> dear mr. bates,
>
> many thanks for answering to my mail.
> "1|school/class" is the same as "1|school + 1|class", isn't it?
If the classes have unique labels they are. Technically the expression
(1 | school/year) expands to (1|school:class) + (1|school)
but if the classes are labeled uniquely then (1|school:class) is the
same as (1|class)
I find it easier to avoid using the (1|school/class) notation because
it is not commutative. (1|class/school) is not the same as
(1|school/class) and I have seen people choose the wrong one.
The whole issue of crossed versus nested factors is in some ways
artificial. The model specification in lmer and glmer is the same
provided that the factors have appropriate labels.
> - this would be the second model i mentioned.
> Zitat von Douglas Bates <bates at stat.wisc.edu>:
>
>> On Fri, Nov 12, 2010 at 5:09 AM, Kay Cecil Cichini
>> <Kay.Cichini at uibk.ac.at> wrote:
>>>
>>> dear listers,
>>>
>>> i'd very much appreciate help with setting up the right parameterization
>>> for
>>> the following design:
>>> 4 regions, in each region 3 to 12 schools, at each school 2-4 classes and
>>> each class tested before and after intervention, yielding a bimomial
>>> outcome
>>> (pupils that passed / not passed a test).
>>>
>>> i'm interested in differences between before and after (factor =
>>> "interv")
>>> intervention outcomes (X = passed, n = passed + not passed) and in the
>>> interaction region * interv.
>>>
>>> i tried with:
>>> glmer (cbind(X, n - X) ~ region * interv + (region | school / class),
>>> family
>>> = binomial)
>>
>> This model is generating an interaction between the fixed-effects
>> factor "region" and the random-effects factor "school", which doesn't
>> make sense because each school occurs within only one region.
>>
>> The simplest way to establish the desired structure is to create the
>> region, school and class factors so they follow the "each distinct
>> structure corresponds to a distinct level of the factor" rule. For
>> example, if you call the regions "A", "B", "C" and "D" and you call
>> the schools "A01", ... "A10", "B01", ..., "B06", "C01", ..., "C12" and
>> you call the classes "A01a", "A01b", "A01c", ..., "C12d" then you can
>> specify the model very easily as
>>
>> glmer(cbind(X, n - X) ~ region * interv + (1|school) + (1|class),
>> family = binomial)
>>
>> Most of the confusion about model specification comes from the
>> unfortunate practice of labeling the schools as "01", ..., "12"
>> without taking into account that school 1 in region A is not
>> associated in any way with school 1 in region C. In other words, all
>> you need to do is to disambiguate the names of the schools and the
>> classrooms.
>>
>>
>>> and with:
>>> glmer (cbind(X, n - X) ~ region * interv + (1 | school / class), family =
>>> binomial)
>>>
>>>
>>> i'd be happy about comments on the parameterization or any ideas.
>>>
>>> yours,
>>> kay
>>>
>>> _______________________________________________
>>> 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