# Solved – Standardizing quadratic variables in linear model

I have a fundamental question regarding standardization:

Say, I have predictor vector `a`and `b` (`a` is temperature and `b` is rainfall) so they are on different scale.

I want to regress `y` using linear and quadratic function of `a` and `b`. I can do this as following:

``Method 1:  lm(y ~ a + I(a^2) + b + I(b^2))   Method 2:  a2<-a^2 b2<-b^2  lm(y ~ a + a2 + b + b2) ``

However before running my model, I want to standardise `a` and `b` so that their effect size can be comparable. So which one of the two methods below is correct:

``Method 1:  z.a<-scale(a, scale = T, center = T) z.b<-scale(b, scale = T, center = T) lm(y ~ z.a + I(z.a^2) + z.b + I(z.b^2)) ``

OR

``Method 2: a2<- a^2 b2<- b^2 z.a<-scale(a, scale = T, center = T) z.a2<-scale(a2, scale = T, center = T) z.b<-scale(b, scale = T, center = T) z.b2<-scale(b2, scale = T, center = T)  lm(y ~ z.a + z.a2 + z.b + z.b2)     ``
Contents

``# ---------------------------------- n.site <- 200 vege <- sort(runif(n.site, 0, 1))  alpha.lam <- 2 beta1.lam <- 2 beta2.lam <- -2 lam <- exp(alpha.lam + beta1.lam*vege + beta2.lam*(vege^2)) N <- rpois(n.site, lam)  plot(vege, lam)  z.veg <- scale(vege) z.veg2 <- scale(vege^2) z.vege2.1 <- z.veg^2  mod <- glm(N ~ vege + I(vege^2), family = poisson) a <- predict(mod, data = vege)  mod1 <- glm(N ~ z.veg + z.veg2, family = poisson) b <- predict(mod1, data = c(z.veg, z.veg2))  mod2 <- glm(N ~ z.veg + z.vege2.1, family = poisson) c <- predict(mod2, data = c(z.veg, z.vege2.1))  summary(mod) summary(mod1) summary(mod2)  par(mfrow=c(2, 2)) plot(vege, lam) plot(vege, a) plot(vege, b) plot(vege, c) # ---------------------------------- ``