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]] at the Estimate 16.54087 and -2.32337. how can I access at the Std. Error 0.19952 and 0.04251 ? Thank you, Copex --------------------------------- [[alternative HTML version deleted]]
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
Fulvio Copex <copellifulvio at yahoo.it> writes:> 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]] > at the Estimate 16.54087 and -2.32337.[coefficients(mylm)[[1]] would be preferable]> how can I access at the Std. Error 0.19952 and 0.04251 ?m <- coefficients(summary(mylm)) m[1,2] m[2,2] -- 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