[R] Storing p-values from a glm

Duncan Murdoch dmurdoch at pair.com
Tue Apr 6 14:01:38 CEST 2004


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]

Duncan Murdoch




More information about the R-help mailing list