I fitted a LMM with random intercept and random slope by means of lmer():

model <- lmer(y ~ x + (1+x|subject),df)

However, lmer() returned an error:

   Warning messages:
1: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model failed to converge with max|grad| = 0.037749 (tol = 0.002, component 1)
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv,  :
  Model is nearly unidentifiable: very large eigenvalue
 - Rescale variables?;Model is nearly unidentifiable: large eigenvalue ratio
 - Rescale variables?

Therefore, I standardized the predictor by centering and dividing by the SD:

x <- (x-mean(x)/sd(x))

This made the model work. But now the intercept and slope for predictions do not represent the original scale anymore. But this was actually my reason for fitting the model: providing a formula to predict future observations.

I retrieved the original slope by dividing the slope by the sd(predictor)


But I cannot retrieve the intercept anymore. As far as I understood, the intercept is now the value of y at the mean slope value, expressed in SDs:


I would like to have the intercept in the classical meaning, i.e. the value of y when x = 0. Is it possible to retrieve this from the model?


1 Answer 1


You have a model of the form $$y = a + b\left( {\frac{{x - {\mu _x}}}{{{\sigma _x}}}} \right)$$ And need the parameters of this equivalent model $$y = c + dx$$

($\mu_x$ and $\sigma_x$ are the mean and the standard deviation of $x$.)

The two models are equivalent by definition, therefore it is easy to see that $$ c = a - b\frac{{{\mu _x}}}{{{\sigma _x}}}$$ $$ d = \frac{b}{{{\sigma _x}}}$$

  • $\begingroup$ I am sorry but a new problem appeared. Your solution works perfectly. However, I would like to plot the intercept of each participant on the original scale. While the mean of the converted intercepts (conv. back to original scale) is the same as the mean intercept of the model on the original scale, the intercepts of the participants each on their own differ. In other words, mean(intercepts_original_scale) = converted intercept by your formula = mean(intercepts_converted_by_y_formula) but intercepts_original_scale != intercepts_converted. Any help would be greatly appreciated. $\endgroup$ Jan 15, 2018 at 13:37
  • 1
    $\begingroup$ I am not sure I follow... individual (random) intercepts can be converted just in the same way as the mean (fixed-effect) intercept. However when you compute individual intercepts you have to be careful in 1) summing the subject-specific intercept with the fixed-effect intercept, and 2) use the subject-specific slope to convert it to the original scale of the predictor $\endgroup$
    – matteo
    Jan 16, 2018 at 14:17
  • $\begingroup$ Excuse the confusion. I have model1 w/ rnd intercept only and model2 w/ rnd intercept+rnd slope and standardized predictor. When convert by your formula, mean intercept & mean slope of model2 becomes the same as model1. But the individual intercepts cannot be converted. Seems like adding a rnd slope changes the individual intercepts but not the mean intercept? $\endgroup$ Jan 17, 2018 at 15:19
  • 1
    $\begingroup$ If model 1 and 2 have different random effect structures, their estimated parameters don't need to be equivalent. You can convert individual intercept, if you take subject-specific effects correctly into account. For model 2 for example, the intercept for subject $i$ is computed as $ c_i = \left( {a + {u_{0i}}} \right) - \left( {b + {u_{1i}}} \right)\frac{{{\mu _x}}}{{{\sigma _x}}}$ where $u_{0i}$ and $u_{1i}$ are the subject-specific deviations from the mean intercept and slope, respectively (you can find them with the function ranef()) $\endgroup$
    – matteo
    Jan 17, 2018 at 16:27
  • 1
    $\begingroup$ I've sent you a pull request with some code demonstrating that the calculations are correct and "work" $\endgroup$
    – matteo
    Jan 31, 2018 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.