What happens if we run a model based on the z-scores of independent variables instead of the raw values?
mtcars$zdisp = (mtcars$disp - mean(mtcars$disp))/sd(mtcars$disp)
mtcars$zwt = (mtcars$wt - mean(mtcars$wt))/sd(mtcars$wt)
What is the same and what is different?
mod1 = lm(mpg ~ disp + wt,data=mtcars)
modz = lm(mpg ~ zdisp + zwt, data = mtcars)
summary(mod1)
##
## Call:
## lm(formula = mpg ~ disp + wt, data = mtcars)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.4087 -2.3243 -0.7683 1.7721 6.3484
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 34.96055 2.16454 16.151 4.91e-16 ***
## disp -0.01773 0.00919 -1.929 0.06362 .
## wt -3.35082 1.16413 -2.878 0.00743 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.917 on 29 degrees of freedom
## Multiple R-squared: 0.7809, Adjusted R-squared: 0.7658
## F-statistic: 51.69 on 2 and 29 DF, p-value: 2.744e-10
summary(modz)
##
## Call:
## lm(formula = mpg ~ zdisp + zwt, data = mtcars)
##
## Residuals:
## Min 1Q Median 3Q Max
## -3.4087 -2.3243 -0.7683 1.7721 6.3484
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 20.0906 0.5156 38.967 < 2e-16 ***
## zdisp -2.1968 1.1390 -1.929 0.06362 .
## zwt -3.2786 1.1390 -2.878 0.00743 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 2.917 on 29 degrees of freedom
## Multiple R-squared: 0.7809, Adjusted R-squared: 0.7658
## F-statistic: 51.69 on 2 and 29 DF, p-value: 2.744e-10
pred1 = predict(mod1)
predz = predict(modz)
dfres = data.frame(pred1,predz)
head(dfres)
## pred1 predz
## Mazda RX4 23.34543 23.34543
## Mazda RX4 Wag 22.49097 22.49097
## Datsun 710 25.27237 25.27237
## Hornet 4 Drive 19.61467 19.61467
## Hornet Sportabout 17.05281 17.05281
## Valiant 19.37863 19.37863
pred1 = predict(mod1)
predz = predict(modz)
dfres = data.frame(pred1,predz)
head(dfres)
## pred1 predz
## Mazda RX4 23.34543 23.34543
## Mazda RX4 Wag 22.49097 22.49097
## Datsun 710 25.27237 25.27237
## Hornet 4 Drive 19.61467 19.61467
## Hornet Sportabout 17.05281 17.05281
## Valiant 19.37863 19.37863
Repeat this exercise using the logarithmic transformation.