Hi Rachel!

The Df column in the anova output suggests that both your models had the
same number of parameters.  This is odd because you removed one
parameter in the formula.  The only way I think this could happen is
when the factor Listener.f is constant.  In this case, I think lmer
would drop Listener.f such that it is in none of the two models.

Hope that helps,

  Titus


On 2016-09-18 Sun 21:57, Rachel Ostrand wrote:
> Hi everyone,
>
> I'm having trouble with some 2-factor glmer models that I'm trying to run,
> such that the model with one of the main effects removed is coming out
> identical to the full model. Some colleagues suggested that this might be
> due to the coding of my factors, specifically because I have a factor that
> has 3 levels, and that one needs to be treated differently, but I'm not
> sure how - or why - to do that.
>
> Brief summary of my data:
> -My DV (called Target_E2_pref) is a binary categorical variable.
> -There are two categorical IVs: Listener (2 levels) and SyntaxType (3
> levels).
> -Listener varies by both subject and item (i.e., picture); SyntaxType only
> varies by subject.
>
> When I dummy coded my variables using contr.treatment(), the model with the
> main effect of Listener removed from the fixed effects comes out identical
> to the full model:
>
> SoleTrain = read.table(paste(path, "SoleTrain.dat", sep=""), header=T)
> SoleTrain$Listener.f = factor(SoleTrain$Listener, labels=c("E1", "E2"))
> contrasts(SoleTrain$Listener.f) = contr.treatment(2)
> SoleTrain$SyntaxType.f = factor(SoleTrain$SyntaxType,
> labels=c("Transitive", "Locative", "Dative"))
> contrasts(SoleTrain$SyntaxType.f) = contr.treatment(3)
>
> # Create full model:
> SoleTrain.full<- glmer(Target_E2_pref ~ Listener.f*SyntaxType.f + (1 +
> Listener.f*SyntaxType.f|Subject) + (1 + Listener.f|Picture), data =
> SoleTrain, family = binomial, verbose=T,
> control=glmerControl(optCtrl=list(maxfun=20000)))
>
> # Create model with main effect of Listener removed:
> SoleTrain.noListener<- glmer(Target_E2_pref ~ SyntaxType.f +
> Listener.f:SyntaxType.f + (1 + Listener.f*SyntaxType.f|Subject) + (1 +
> Listener.f|Picture), data = SoleTrain, family = binomial, verbose=T,
> control=glmerControl(optCtrl=list(maxfun=20000)))
>
>> anova(SoleTrain.full, SoleTrain.noListener)
> Data: SoleTrain
> Models:
> SoleTrain.full: Target_E2_pref ~ Listener.f * SyntaxType.f + (1 +
> Listener.f * SyntaxType.f | Subject) + (1 + Listener.f | Picture)
> SoleTrain.noListener: Target_E2_pref ~ SyntaxType.f +
> Listener.f:SyntaxType.f + (1 + Listener.f * SyntaxType.f | Subject) + (1 +
> Listener.f | Picture)
>                      Df    AIC    BIC  logLik deviance Chisq Chi Df
> Pr(>Chisq)
> SoleTrain.full       30 2732.5 2908.5 -1336.2   2672.5
>
> SoleTrain.noListener 30 2732.5 2908.5 -1336.2   2672.5     0      0
>  1
>
> However, I don't have this problem when I test for the main effect of
> SyntaxType, and remove the SyntaxType.f factor from the fixed effects.
> (That is, this produces a different model than the full model.)
>
> Someone suggested that Helmert coding was better for factors with more than
> two levels, so I tried running the same models except with Helmert coding
> [contrasts(SoleTrain$SyntaxType.f) = contr.helmert(3)], but the models come
> out identical to the way they do with dummy coding. So why does the model
> with the main effect of Listener removed the same as the model with the
> main effect of Listener retained?
>
> Any suggestions as to what I'm doing wrong?
>
> Thanks!
> Rachel

Attachment: signature.asc
Description: PGP signature

Reply via email to