[R] scale,centre,and get more interactions

Ben Bolker bbolker at gmail.com
Fri Oct 22 19:03:58 CEST 2010


Baris Demiral <demiral.007 <at> googlemail.com> writes:

> 
> Hi folks,
> 
> I am new to lme in R, and I have a question regarding to the effect of scale
> function on the lme. When I use the function to scale and centre the levels
> of the fixed effects (e.g., X and Y; both have two levels) and write them to
> new columns:
> ex:
> dat$cX<-scale(as.numeric(dat$X),center = TRUE, scale = FALSE)
> dat$cY<-scale(as.numeric(dat$Y),center = TRUE, scale = FALSE)
> 
> and compare the lme of centred model ran on cX and cY with the non-centred
> model run on X and Y:
> 
> centred.model
> <-
lmer(quest.ACC~1+cX*cY+(1|Subject)+(1|SetNo),data=dat.Transfer,family='binomial')
> non.centred.model<-
> lmer(quest.ACC~1+X*Y+(1|Subject)+(1|SetNo),data=dat.Transfer,family='binomial')
> 
> I find that the two models give very different results not only for the
> intercept of the fixed effect effects (which I can understand), but also on
> the variance of the fixed effect coefficients, leading to the huge
> differences in some case (interactions emerge).


  It's hard to say exactly without the data. However: it is *not* surprising
that in a model with interactions the estimates of the fixed effects
change when you center the variables.  The meaning of the main-effect
parameter of X is 'the effect per unit increase in X on the response
variable, *when Y=0*', and vice versa.  What *is* surprising is that
the interaction term is different.  I would have expected that the
interaction would be identical between models (unless there are numerical
issues going on that are solved by centering: are you getting any
warnings?), but that the intercept and both fixed effects would differ.

  For simplicity's sake, what happens if you try this with glm,
ignoring random effects?

  I would suggest that follow-ups might go to r-sig-mixed-models at r-project.org



More information about the R-help mailing list