# [R] Getting betas in lm

Ragnar Beer rbeer at uni-goettingen.de
Thu Apr 27 15:18:28 CEST 2000

```>  > > is there a simple way to get beta weights from lm? So far I've done
>  > > z-transformations of the variables before using them in lm.
>  >
>This is probably the SPSS abomination for "standardized coefficients"
>sticking its head up, i.e. coefficients multiplied by the SD of the
>corresponding x. [This is really great fun when you use SPSS along
>with teaching materials which uses beta for (the true value of) the
>regression parameters, which *is* the standard notation in theoretical
>statistics.]

Yes, I'm coming from SPSS... Interpreting beta weights is standard in
psychology and makes life a lot easier, because I don't have to keep
in mind the range of each and every scale my variables refer to.

What do you mean by coefficients multiplied by the SD of the
corresponding x? Sounds wrong to me.

>z-transforming is correct (insofar as the whole concept makes sense).
>If you have only numeric predictors, it might be handy to give it as a
>matrix scale(cbind(x1,x2,...)), for the general case, one could do
>that to model.matrix(formula), but it gets unwieldy to give a general
>solution (and the interpretation of std.coef. for factor contrasts is
>dubious anyway). Watch out for NAs, by the way!

"scale" works great! One problem: I know z-scores to be calculated

z = (x-mean(x)) / sd(x)

where sd(x) is the _sample_ standard deviation calculated with n and
not n-1. Have I gotten something wrong?

--Ragnar

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```