[R-lang] Simple effects in mixed logit models

T. Florian Jaeger tiflo at csli.stanford.edu
Wed Dec 16 11:34:16 PST 2009


Roger,

I agree with you that a simple effect seems out of place here. To get at
simple effects, there are two options:

1) run the model without only primecent as a predictor on the halves of the
data (loosing power).

2) recode your variables using treatment coding. To be overly explicit
(since treatment coding is the default in R):


> contrasts(L2prim$lang) <- contr.treatment(L2prim$lang)

> contrasts(L2prim$prime) <- contr.treatment(L2prim$prime)

> primanal=lmer(score ~lang*prime + (1|PID) + (1|ITEM), data=L2prim, family
= "binomial")

In such a model, the "main" effects are actually simple (main) effects. For
example, the coefficient of lang will give give you the effect of Lang if
Prime == 0, where as the effect of Lang for Prime == 1 corresponds to the
sum of the interaction coefficient and the coefficient of Lang. Now, the
problem, of course, is that treatment coding leads to collinearity between
the "main" effects and the interaction (even in a balanced sample). In a
perfectly balanced sample, the correlation (not the fixed effect
correlation) will be .33, which is still ok. As long as unbalance due to
data exclusion is pretty much random, this correlation should not go up much
beyond .38 (I did some simulation).

In any case, since ANOVA are omnibus test, you can get at least that by
simple comparing the above model to a model without the interaction or
without any of the simple (main) effects (using anova(model1, model2)).
Model comparison is robust against collinearity.

HTH,

Florian


On Wed, Dec 16, 2009 at 7:27 AM, Roger van-Gompel <
r.p.g.vangompel at dundee.ac.uk> wrote:

>  Hi there,
>
>
>
> I have a 2 (language: Swe vs. Eng) x 2 (prime: pp vs. do) design and was
> wondering how I do simple effects in mixed logit models.  I could delete
> one level of a variable and then analyse the other level of a variable
> (e.g., Swe pp vs. Swe do), but I suspect that that’s not the appropriate way
> of doing it.
>
>
>
> I have attached my analyses and output. Note that my variables are effect
> coded.  I don’t have an interaction and so strictly speaking, I shouldn’t
> analyse simple effects, but reviewers have asked us to.
>
>
>
> Thanks a lot for any help!
>
>
>
> Roger van Gompel
>
>
>
>
>
> > library(lme4)
>
> > L2prim = read.table("forLME.txt", header=TRUE)
>
> > L2prim$langcent <- scale(as.numeric(L2prim$language))
>
> > L2prim$primecent <- scale(as.numeric(L2prim$prime))
>
> > L2prim$PID=as.factor(L2prim$PID)
>
> > L2prim$ITEM=as.factor(L2prim$ITEM)
>
> > head(L2prim)
>
>   LIST PID ITEM language prime score  langcent  primecent
>
> 1    1   2    4      swe    do     1  1.008740 -0.9742244
>
> 2    1   2    7      swe    do     0  1.008740 -0.9742244
>
> 3    1   2    8      swe    pp     0  1.008740  1.0248334
>
> 4    1   2   20      swe    pp     0  1.008740  1.0248334
>
> 5    1   2   22      eng    pp     0 -0.989767  1.0248334
>
> 6    1   2   23      swe    pp     0  1.008740  1.0248334
>
> > primanal=lmer(score ~langcent*primecent + (1|PID) + (1|ITEM),
> data=L2prim, family = "binomial")
>
> > summary(primanal)
>
> Generalized linear mixed model fit using PQL
>
> Formula: score ~ langcent * primecent + (1 | PID) + (1 | ITEM)
>
>    Data: L2prim
>
>  Family: binomial(logit link)
>
>       AIC      BIC    logLik deviance
>
>  559.0337 590.1759 -272.5168 545.0337
>
> Random effects:
>
>  Groups Name        Variance Std.Dev.
>
>  ITEM   (Intercept) 2.2551   1.5017
>
>  PID    (Intercept) 2.5343   1.5919
>
> # of obs: 632, groups: ITEM, 40; PID, 32
>
>
>
> Estimated scale (compare to 1)  0.880811
>
>
>
> Fixed effects:
>
>                     Estimate Std. Error  z value Pr(>|z|)
>
> (Intercept)        -0.946211   0.393646 -2.40371 0.016230 *
>
> langcent            0.012060   0.108898  0.11075 0.911818
>
> primecent           0.337744   0.110732  3.05010 0.002288 **
>
> langcent:primecent -0.099484   0.109631 -0.90744 0.364172
>
> ---
>
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
>
>
> Correlation of Fixed Effects:
>
>             (Intr) lngcnt prmcnt
>
> langcent    -0.001
>
> primecent   -0.025 -0.033
>
> lngcnt:prmc  0.007 -0.048 -0.005
>
>  The University of Dundee is a registered Scottish charity, No: SC015096
>
> _______________________________________________
> R-lang mailing list
> R-lang at ling.ucsd.edu
> http://pidgin.ucsd.edu/mailman/listinfo/r-lang
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pidgin.ucsd.edu/pipermail/r-lang/attachments/20091216/09717fad/attachment-0001.htm>


More information about the R-lang mailing list