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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to