[R] Getting betas in lm

Prof Brian D Ripley ripley at stats.ox.ac.uk
Thu Apr 27 10:36:33 CEST 2000


On Thu, 27 Apr 2000, Ragnar Beer wrote:

> Howdy,
> 
> 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.

Could you please explain your notation?  coef(fit) gives the coefficients,
which may be what you want.

> I also wonder whether there is a function to calculate variance with 
> n instead of (n-1)?

cov.wt does so in S-PLUS but not R.  It is very easy to write one (if
you really want one):

myvar <- function(x, y) var(x)*(1 - 1/NROW(x))

I think does what you want, at least if there are no missing values.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list