[R] Storing p-values from a glm
Douglas Bates
bates at stat.wisc.edu
Tue Apr 6 14:27:30 CEST 2004
Duncan Murdoch <dmurdoch at pair.com> writes:
> On Tue, 06 Apr 2004 12:35:39 +0000, Roy Sanderson
> <R.A.Sanderson at newcastle.ac.uk> wrote :
>
> >Hello
> >
> >I need to store the P-statistics from a number of glm objects. Whilst it's
> >easy to display these on screen via the summary() function, I'm not clear
> >on how to extract the P-values and store them in a vector.
>
> Generally when summary() functions display something, they also return
> it as part of their value.
>
> In the case of summary() for glm objects, the table of coefficients
> (including estimates, std error, z value, and p value) is returned as
> a matrix in summary(glm.object)$coefficients. You can extract the
> p-values as
>
> summary(glm.object)$coefficients[,4]
An alternative and, I think, a preferred form is
coef(summary(glm.object))
Someone writing a summary method for another class of fitted model
objects may not want to include a component called coefficients but
can certainly implement a coef method.
More information about the R-help
mailing list