test for significance of interaction in linear mixed models in nlme in R

后端 未结 3 2069
清歌不尽
清歌不尽 2021-02-05 23:55

I use lme function in the nlme R package to test if levels of factor items has significant interaction with levels of factor conditi

3条回答
  •  一生所求
    2021-02-06 00:26

    I respectfully disagree with @sven-hohenstein

    In R, the default coding for categorial variables is treatment contrast coding. In treatment contrasts, the first level is the reference level. All remaining factor levels are compared with the reference level.

    First, the fixed effects are specified here with a zero intercept, ... ~ 0 + .... This means that the condition coding is no longer contr.treatment. If I'm not mistaken, the main effects of Control and Treatment are now interpretable as their respective deviations from the group mean...

    In your model, the factor items has three levels: E1, E2, and E3. The two contrasts test the difference between (a) E2 and E1, and (b) E3 and E1. The main effects of these contrasts are estimated for the level Control of the factor condition, since this is the reference category of this factor.

    ...when the value of items is at its reference level of E1! Therefore:

    • Main effect Control = how much Control:E1 observations deviate from the mean of item E1.
    • Main effect Treatment = how much Treatment:E1 observations deviate from the mean of item E1.
    • Main effect E2 = how much Control:E2 observations deviate from the mean of item E2.
    • Main effect E3 = how much Control observations deviate from the mean of item E3.
    • Interaction Treatment:E2 = how much Treatment:E2 observations deviate from the mean of item E2
    • Interaction Treatment:E3 = how much Treatment:E3 observations deviate from the mean of item E3.

    Thanks for the pointer to estimable, I haven't tried it before. For custom contrasts, I've been (ab)using glht from the multcomp package.

提交回复
热议问题