[R] getting the std errors in the lm function

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Mar 8 12:22:38 CET 2004


On Mon, 8 Mar 2004, Fulvio Copex wrote:

> Hello,
> I have a simple question for you:
> making:
> mylm<-lm(y~x)
> summary(mylm)
> I get the following results:
> ******************************************************
> Coefficients:
>             Estimate Std. Error t value Pr(>|t|)    
> (Intercept) 16.54087    0.19952   82.91   <2e-16 ***
> x[1:19]     -2.32337    0.04251  -54.66   <2e-16 ***
> ******************************************************
> now I can access easily with
> mylm$coefficients[[1]]
> mylm$coefficients[[2]]

Use [] not [[]] for a non-list vector, and better

coef(mylm)[1] etc

> at the Estimate 16.54087 and -2.32337.
> how can I access at the Std. Error 0.19952 and 0.04251 ?

coef(summary(mylm))[, 2]


-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list