[R-lang] Re: Random slopes

Alex Fine afine@bcs.rochester.edu
Thu Dec 30 15:42:37 PST 2010


"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
>


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