I have a linear mixed model that analyses the effect of multiple continuous and a categorical (two level, deviation coding of contrasts) predictor on a normally distributed outcome variable (dv). Following Barr (2021, https://psyteachr.github.io/stat-models-v1/multiple-regression.html?q=scal#standardizing-coefficients) I wanted to z-transform the continuous predictors (using scale()) to standardise the coefficients of the continuous predictors. In one of the models, R also gave back the following warning: ## Warning: Some predictor variables are on very different scales: consider rescaling.

However, I noticed that scaling changes the main effect of the categorical predictor. For the purpose of clarity, I will present a smaller but representative version of the actual model here to illustrate my point. This is the lmer command I used for this smaller model:

m = lmer(formula = dv ~ cat * cont + (1 |sub) + (1 | stm), data = df_sel)

I did this once with the raw and once with the scaled continuous predictor:

outcome of the models with the raw and the scaled cont predictor

As you can see, it changes the main effect of the categorical predictor while the continuous and the interaction stay the same. I would have expected that none of the statistical values change, just the estimates. When investigating a bit, the only difference I found was that scaling gets rid of some moderate colinearity:

colinearity between predictors

Can this really have such a large effect on the main effect of the categorical predictor? Am I justified in scaling the predictor?

Edit: Here are the outputs plot_model(m2, type = "int"):




2 Answers 2


There are a number of principles at play here.

  1. Scaling is generally a bad idea, except for the internal scaling that's done in the software that does the estimation. It assumes linearity of effects and assumes that standard deviations are good scale measures. Especially for asymmmetrically distributed variables the SD is not a good measure. And it is greatly affected by extreme values.
  2. Scaling makes interpretation harder. Interpretations are easiest on the original scale.
  3. Categorical variables should not be scaled
  4. Even if you don't scale the categorical variable but you do allow it to interact with a (scaled) continuous predictor, all of the categorical effects will be changed by scaling.
  5. Check that the correlation pattern assumed in your model reflects the actual correlations seen in the data. Mixed effect models when used with default correlation structures often do not fit. See this for more.
  • $\begingroup$ Thanks for the input. I scaled the data because of a warning in R: ## Warning: Some predictor variables are on very different scales: consider rescaling. Centering without adjusting the continuous predictor with the standard deviation produces exactly the same result as scaling. Unfortunately, I cannot find your reference in 5. Would you mind posting it again? $\endgroup$
    – Max
    Jul 13 at 11:15
  • 1
    $\begingroup$ That warning doesn't make much sense. I fixed the link. $\endgroup$ Jul 13 at 11:57
  • $\begingroup$ Thank you for fixing the link. Do you have any recommendations on how to evaluate if the categorical predictor significantly predicts the outcome? According to anova() the model without the categorical predictor has a significantly decreased fit compared to the model including the categorical predictor (both with the raw continuous predictor). $\endgroup$
    – Max
    Jul 14 at 10:36
  • $\begingroup$ Likelihood ratio or Wald $\ch^2$ tests and change in marginal (over random effects) $R^2$. $\endgroup$ Jul 14 at 13:34

Have you tried plotting the predicted values from your model? I can't reproduce your issue, so I can't be 100% sure, but the changes are coming from you reading the model printout, and what those numbers actually are. I'm going to walk through them here:

(Intercept) is the value of the outcome when continuous predictors are at 0 and categorical predictors are at the reference level. You'll see that this changes as well, which makes sense because after standardizing the continuous predictor, we've changed what zero means.

cat[S.A] Is the effect of the difference between the two levels of the categorical predictor when the continuous variable it is interacting with is at zero. As what zero is for the continuous predictor has changed, this has also changed.

cont Is the effect of the continuous variable for only the reference level of the categorical predictor, because there is an interaction. It is the change of the outcome variable associated with a change in 1 in the cont variable. This changes too, because instead of a change in 1 on the original scale, it is now a change of 1 SD.

cat[S.A]*cont This is the change in the effect of cont for the reference level compared to the S.A level.

So as you can see, the numbers reported here rely on what zero means in the context of the regression. You can plot the interaction from both models using the sjPlot package and the following code, and you should see the same pattern, as all you have done is applied a linear transformation to one variable:

plot_model(m, type = "int")

Also, regarding the collinearity, this post could help you understand what is going on: Does standardising independent variables reduce collinearity?

  • $\begingroup$ Thank you for the helpful explanation of the values. The SD of the original continuous predictor is 0.0689, the mean is 0.13651. Centering the data by df_sel$cont = df_sel$cont - mean(df_sel$cont) produces similar results as scaling the variable. I will add the plot_model to the main post. $\endgroup$
    – Max
    Jul 13 at 11:42
  • 1
    $\begingroup$ Right, I hadn't thought through that part. But as you can see from the plots, the model itself doesn't change $\endgroup$
    – sjp
    Jul 13 at 21:59
  • $\begingroup$ Yes, it doesn't change. Do you have any recommendations on evaluating if there is a meaningful / significant effect of the categorical predictor on the outcome? I tried using anova() for model comparison of one with and without the predictor according to which the model with the factor is significantly better than the one without. $\endgroup$
    – Max
    Jul 14 at 10:34
  • 1
    $\begingroup$ That's a way to do it $\endgroup$
    – sjp
    Jul 14 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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