[Rd] problems extracting parts of a summary object
Ross Boylan
ross at biostat.ucsf.edu
Mon Mar 22 23:43:33 CET 2010
On Mon, 2010-03-22 at 16:30 -0600, tplate at cybermesa.com wrote:
> Are you sure you're extracting the coefficients component of the summary
> object and not the lm object?
>
> Seems to work ok for me:
> > xm <- lm(y ~ x, data=data.frame(y=rnorm(20), x=rnorm(2)))
> > summary(xm)$coefficients
> Estimate Std. Error t value Pr(>|t|)
> (Intercept) 1.908948 1.707145 1.118210 0.2781794
> x 1.292263 1.174608 1.100165 0.2857565
> > xm$coefficients
> (Intercept) x
> 1.908948 1.292263
>
> -- Tony Plate
> class(summary(r$individual[[2]]))
[1] "summary.lm"
But maybe I'm not following the question.
Ross
>
> On Mon, March 22, 2010 4:03 pm, Ross Boylan wrote:
> > summary(x), where x is the output of lm, produces the expectedd display,
> > including standard errors of the coefficients.
> >
> > summary(x)$coefficients produces a vector (x is r$individual[[2]]):
> >> r$individual[[2]]$coefficients
> > tX(Intercept) tXcigspmkr tXpeld tXsmkpreve mn
> > -2.449188e+04 -4.143249e+00 4.707007e+04 -3.112334e+01 1.671106e-01
> > mncigspmkr mnpeld mnsmkpreve
> > 3.580065e+00 2.029721e+05 4.404915e+01
> >> class(r$individual[[2]]$coefficients)
> > [1] "numeric"
> >
> > rather than the expected matrix like object with a column for the se's.
> >
> > When I trace through the summary method, the coefficients value is a
> > matrix.
> >
> > I'm trying to pull out the standard errors for some rearranged output.
> >
> > How can I do that?
> >
> > And what's going on? I suspect this may be a namespace issue.
> >
> > Thanks.
> > Ross Boylan
> >
> > P.S. I would appreciate a cc because of some mail problems I'm having.
> >
> > ______________________________________________
> > R-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> >
> >
>
>
More information about the R-devel
mailing list