# Standardizing quadratic variables in linear model [closed]

I have a fundamental question regarding standardization:

Say, I have predictor vector aand 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)

• You leave us guessing, because you write "I want to standardize x" but you don't explain the purpose. The only way we could provide objective opinions about which method (if either) is "correct" would be to know what you are attempting to accomplish. So what would that be?
– whuber
Commented Feb 26, 2017 at 16:09
• Okay. I have edited my question now. I have two predictors on different scale (rainfall and temperature), this is why I wanted to standardise them so that their coefficients become comparable. Commented Feb 26, 2017 at 16:24
• If you do not standardise you get coefficients in terms of a degree of temperature and a mm of rain (or however you measure rainfall in your locale). What could be simpler than that to interpret rather than changes per standard deviation which other scientists with different standard deviations will not be able to use? Commented Feb 26, 2017 at 17:30
• Coming back to this in 2023, it is still not clear to me how to interpret units after standardization in method 1 and method 2 and if interpretation would differ given method 1 or method 2. Can someone clarify this? Thanks Commented Jan 31, 2023 at 12:50

## 3 Answers

I was just looking at the same question and did some simple simulations to get the answer using a poisson glm. It turns out that both methods make the exact same predictions as using the unstandardized variables. The difference is that method 2 (reflected in "mod1" in the code below) gives the exact same z-scores and p-values for both variables as the unstandardized model ("mod" below), while method 1 (reflected in "mod2" below) estimates that variable 1 is not significant while the quadratic is.

Here is the simulation code in R:

# ----------------------------------
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)
# ----------------------------------


One add-on to Neerajs and Andrews answer:

If you consider the correlations between the linear and squared term, you will see that method 2 (first squaring then scaling) produces the same correlation as the original variables. Method 1 on the other hand creates much more orthogonal variables:

vege <- sort(runif(200, 0, 1))

veg2<-vege^2
z.veg <- scale(vege)
z.veg2 <- scale(veg2)
z.vege2.1 <- z.veg^2

#original variables
cor(veg2,vege) #highly correlated e.g. 0.97

#method 2
cor(z.veg2,z.veg) #highly correlated e.g. 0.97

#method 1
cor(z.vege2.1,z.veg) #much less correlated e.g. -0.13


Thus collinearities in a multiple regressions are removed, which might be worthy of consideration. But still I'd love to hear an expert on that

I would prefer the first method. Here you have normalized the data initially itself before taking the linear / quadratic terms in your equation.

Standardization is meant for data (predictor) to bring them into same scale.

It is not related with any terms. You can go to cubic/quadratic terms too here in your equation based on your need.