How to scale interactions in regression (quantitative*qualitative) Supose I have two variables in a model, and their interaction, like this:
lmer(response~x1+x2+x1*x2+(1|time), data=db) 

If x1 have a very big scale (like a city population, for example), probably I'm going to need to scale / center the variable. I know that if x1 and x2 are continuous, I can scale (or center) all predictors, and use scale(x1*x2) in the interaction term. But what if x2 is a categorical variable? Is it correct to use scale(x1)*x2? and how can I unscale it in both cases (one categorical, one continuous, and two continuous)?
 A: Scaling predictors is necessary if (1) you need to have predictors on comparable scales, as with principal-component analysis or penalized methods like ridge regression or LASSO or (2) you will run into numerical problems as can occur with exponentiated predictor values in survival analysis. You don't seem to be in either situation.
You can lower the magnitudes of regression coefficients if you rescale a continuous predictor. For example, if you express a city population as a predictor in terms of millions of inhabitants then  the magnitude of its regression coefficient will be $10^{-6}$ of what it would be if you used an unscaled population. But so long as you are consistent the ultimate results will be the same either way.
If you also center such a predictor that's involved in an interaction, be careful in interpreting your results as that will change the intercept and the apparent "main effects" of the predictors with which it interacts. Those are typically evaluated for situations when all predictors are at 0 or reference levels, so centering a predictor can change those other coefficients. Again, the ultimate results are the same provided that you are consistent.
There is no one-size-fits-all way to normalize categorical predictors. As you aren't using penalization you don't need to consider that for this application.
A: I would suggest to scale all the variables in your model or none. And yes you can just scale x1 when x2 is a categorical variable. Because than you have response~x1+x2+x1*x2(Cat =1) + x1*x2(Cat=2) +x1*x2(Cat=3), and hence an interaction term for every category. And if you want to unscale the variables you have to add the mean and multiply by the standard deviation, since you scaled the variables to meand 0 and sd = 1. I hope I could help :)
