[R] Multiple linear Regression: Standardized Coefficients
Kenn Konstabel
lebatsnok at gmail.com
Wed Feb 15 12:36:36 CET 2012
It's a bit dangerous to call them "betas" in this list. Standardized
regression coefficients sounds much better :)
A simple way is to first standardize your variables and then run lm again.
lm(scale(height)~scale(age) + factor(sex))
# or, depending on what you want:
lm(height~scale(age)+factor(sex))
# or, but only for Statistica and SPSS users:
lm(scale(height)~scale(age) + scale(sex))
# But of course, it's pointless in your case: standardization makes
sense when units don't matter
# but years and meters (even feet and inches, for that matter!) make
much more sense than sd
# "units" of an unknown sample.
KK
On 2/15/12, David Studer <studerov at gmail.com> wrote:
> 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
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
More information about the R-help
mailing list