[R-sig-ME] effect of adding a constant to predictor

Ben Bolker bbolker at gmail.com
Tue Sep 5 17:54:01 CEST 2017

   On first glance this is indeed a bit surprising. However, I believe
the reason is that you've specified group and input2 as separate
(independent) random effects, without allowing a correlation between
them, which means that the random-effects model is no longer invariant
to shifts in the parameters.  If you had used (1+input2|group) as your
random effect instead, I believe you would get the same
log-likelihood/AIC either way.

  This mentioned on p. 7 of vignette("lmer",package="lme4"):

> Although mixed models where the random slopes and intercepts are
assumed independent are commonly used to reduce the complexity of
random-slopes models, they do have one subtle drawback. Models in which
the slopes and intercepts are allowed to have a non-zero correlation
(e.g., fm1) are invariant to additive shifts of the continuous predictor
(Days in this case). This invariance breaks down when the correlation is
constrained to zero; any shift in the predictor will necessarily lead to
a change in the estimated correlation, and in the likelihood and
predictions of the model ... The use of such models should ideally be
restricted to cases where the predictor is measured on a ratio scale
(i.e., the zero point on the scale is meaningful, not just a location
defined by convenience or convention).

   Ben Bolker

On 17-09-05 11:46 AM, Don Cohen wrote:
> I expected that adding a constant to an input in a mixed
> model would affect some of the coefficients, but not such basic
> stuff as AIC (or loglik, from which it is derived).
> But I seem to have been wrong about that:
>> AIC(lmer(output ~ input1 + I(input1 * input2) + input2 + ((1 | group) + (0 + input2 | group)) , data=xxx, REML=F, control=contr))
> [1] 1556.341
>> xxx$input2 = xxx$input2 + 1
>> AIC(lmer(output ~ input1 + I(input1 * input2) + input2 + ((1 | group) + (0 + input2 | group)) , data=xxx, REML=F, control=contr))
> [1] 1551.005
> Can someone explain why this change to input2 affects AIC (or loglik) ?
> BTW, changing (0 + input2 | group) to (0 + input1 | group) 
> produces the same AIC before and after the change to input2.
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

More information about the R-sig-mixed-models mailing list