R-beta: accessing SEs from lm object

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Mon Jul 13 23:40:20 CEST 1998


Bill Simpson <wsimpson at uwinnipeg.ca> writes:

> 
> If I do
> fit<-lm(y~x)
> Is it possible to access the SE of the slope?
> (Analogous to getting the slope like this: fit$coef[2])
> 
> If not, it would be handy.
> 
> (I want SE of 1/slope, and an approx way is fit$se[2]/(fit$coef[2]^2))
> 
> Thanks for any help.

This works:

R> y<-rnorm(5)
R> x<-rnorm(5)
R> coef(summary(lm(y~x)))
               Estimate Std. Error     t value  Pr(>|t|)
(Intercept) -0.12415873  0.4659638 -0.26645575 0.8071530
x           -0.03052416  0.3854111 -0.07919896 0.9418614
R> coef(summary(lm(y~x)))["x","Std. Error"]
[1] 0.3854111

[Unfortunately, if you use this in programs it may be unsafe if we
change the column labels in later versions...]

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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