> it also depends on the balance of the levels of SyntaxType in the data.
Well not quite. The idea of testing the "middle level" is right, and whatever
this means doesn't change if the balance of data changes across levels...
But you could have two data sets where the effects of listener for each level
of SyntaxType are the same (between the two data sets), but the significance of
this test changes...
>> On Mon, Sep 19, 2016 at 2:45 PM, Levy, Roger <rl...@ucsd.edu> wrote:
>> Hi Rachel,
>> If your goal is to test the main effect of Listener in the presence of the
>> Listener-SyntaxType interaction, as would typically be done in traditional
>> ANOVA analyses, I recommend you read this brief paper I wrote a few years
>> ago on how to do this:
>> It is exactly targeted at this problem, and explains why you’re getting the
>> behavior you report due to differences in how R treats factors versus
>> numeric variables in formulae. (Setting the contrasts on the factor has no
>> I have no explanation for your reported behavior of why you don’t get this
>> problem when you test for the main effect of SyntaxType; if you give further
>> details, we might be able to help further!
>>> On Sep 18, 2016, at 5:57 PM, Rachel Ostrand <rostr...@cogsci.ucsd.edu>
>>> 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
>>> -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,
>>> # 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,
>>> > anova(SoleTrain.full, SoleTrain.noListener)
>>> Data: SoleTrain
>>> 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
>>> SoleTrain.full 30 2732.5 2908.5 -1336.2 2672.5
>>> SoleTrain.noListener 30 2732.5 2908.5 -1336.2 2672.5 0 0
>>> 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?