Re: [Rd] problems extracting parts of a summary object [solved]

From: Ross Boylan <ross_at_biostat.ucsf.edu>
Date: Mon, 22 Mar 2010 16:17:58 -0700

On Mon, 2010-03-22 at 16:52 -0600, tplate_at_cybermesa.com wrote:
> what's the output of:
> > summary(r$individual[[2]])$coef
>
> my question was basically whether you were doing
> summary(r$individual[[2]])$coef
> or
> r$individual[[2]]$coef
>
> (the second was what you appeared to be doing from your initial email)
>

Doh! Thank you; that was it.
This was interacting with another error, which is perhaps how I managed to miss it.

Ross
> -- Tony Plate
>
> On Mon, March 22, 2010 4:43 pm, Ross Boylan wrote:
> > On Mon, 2010-03-22 at 16:30 -0600, tplate@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
> >> >
> >> >
> >>
> >>
> >
> >
> >
>
>



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 22 Mar 2010 - 23:21:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 23 Mar 2010 - 08:41:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive