[R-lang] Re: Random slopes

Zhenguang Cai s0782345@sms.ed.ac.uk
Thu Dec 30 16:16:47 PST 2010


Hi Alex,

Thanks. Yes, I actually made mistakes in the script. However, another 
question came up. In determining whehter to include the by-subject slope 
for the main effect of A (in a 2*2 design), shall I just compare two 
simple models with A as the predictor only, as in the following:

model1 <- lmer (Y~A+(1|Subject)+(1|Item), data=dat, family=binomial)
model2 <- lmer (Y~A+(A+1|Subject)+(1|Item), data=dat, family=binomial)

or shall I do it between two full models, as the following:

model1 <- lmer (Y~A*B+(1|Subject)+(1|Item), data=dat, family=binomial)
model2 <- lmer (Y~A*B+(A+1|Subject)+(1|Item), data=dat, family=binomial)

Thanks,

Garry


于 2010-12-30 23:42, Alex Fine 写道:
> "A*B" denotes the two main effects A and B in addition to the
> interaction between A and B. "A:B" is just the interaction.
> in the code you provided, you called both models "model1". i assume this
> was a mistake in your e-mail?
> this is indeed the way you'd test to see if the by-subject random slope
> for the interaction is justified, though. if you wanted the code to be a
> little more transparent, you could change "A*B+1" to "A+B+A:B+1", just
> to make it really clear that the models are a minimal pair.
>
> hope that helps,
> alex
>
> Zhenguang Cai wrote:
>> Hi all,
>>
>> I built the following models and did a comparison of them (to
>> determine whether I should include in the model the subject slope for
>> the interaction).
>>
>> model1 <- lmer (Y ~ A*B+(A+B+1|Subject)+(1|Item), data=dat,
>> family=binomial)
>> model1 <- lmer (Y ~ A*B+(A*B+1|Subject)+(1|Item), data=dat,
>> family=binomial)
>>
>> In order to determine whehter the inclusion of the subject slope for
>> the A*B interaction signficantly improves the model fit, I did a
>> comparison of the the two models.
>>
>> anova (model1, model2)
>>
>> In the output, model1 was autmoatically changed into
>>
>> model1 <- lmer (Y ~ A*B+(A:B+1|Subject)+(1|Item), data=dat,
>> family=binomial)
>>
>> What does the A:B mean here? In my original model, I intended to have
>> the main effects of A and B (i.e., A+B). Is there any other way to
>> determine whether the subject slope for the A*B interaction shold be
>> included in the final model?
>>
>> Thanks,
>>
>> Zhenguang
>>
>

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



More information about the ling-r-lang-L mailing list