[R] standardized regression coefficients
Jo Reynaerts
Jo.Reynaerts at econ.kuleuven.be
Wed Feb 15 13:22:25 CET 2012
Hi David
This should do the trick:
data <- cbind(height, sex, age)
data.scaled <- data.frame(apply(data, 2, scale))
fit.scaled <- lm(height ~ age + sex - 1, data = data.scaled)
summary(fit.scaled)
HTH
Jo
======================================================================
Hello everybody,
Can anyone tell me, how to obtain standardized regression coefficients
(betas) for
my independent variables when doing a multiple linear regression?
height<-c(180,160,150,170,190,172)
sex<-c(1,2,2,1,1,2)
age<-c(40,20,30,40,20,25)
fit<-lm(height~age+sex)
summary(fit)
I already heard about the "QuantPsyc"-Package, which, unfortunately,
produces an error
(it says "sd(<data.frame> is deprecated").
Thank you very much!
David
More information about the R-help
mailing list