# Scaling predictors in mixed models

I collected data over multiple locations and years on crop yield and want to regress yield as a function of rainfall and heat-stress which are in two different units. Suppose my dataframe has 5 columns: year, location, yield, rainfall and temperature. These are my steps:

 dat[,4:5] <- scale(dat[, 4:5], center = T, scale  T)
model <- lmer(yield ~ rain + temp + (1|location) + (1|year), data = dat)


After I get this model and I want to use the model for prediction. Suppose I collect new data from different years or locations called dat1 which has 4 columns: year, location, rainfall and temperature.

My confusion is since the fitted model takes in standardised rainfall and temperature, how do I standardise these two variables in the new data dat1? Do I simple do:

dat1[,3:4] <- scale(dat1[,3:4], center = T, scale = T)
predict(model, newdata = dat1)


Or do I have to standarise the new data using mean and standard deviation of the original data dat?

• standarise the new data using mean and standard deviation of the original data – Bryan Krause Jun 21 '18 at 22:32
• Standardization should not be necessary at all, keep the original variables! that makes interpretation easier. And, if for any reason you choose to standardize (what is your reason?), then follow advice from @Bryan Krause – kjetil b halvorsen Jun 22 '18 at 9:29
• I standardised because all of my variables (I have more variables than what I showed before) are in different units and I keep getting warning message that my predictors are on a different scale and consider rescaling. – 89_Simple Jun 22 '18 at 9:31