Skip to content

How to get the P-values from GLM results?

4 messages · Alex Wang, C.H., Bill Venables +1 more

#
abc <- glm(x~y)
summary(abc)
On Wed, Mar 19, 2008 at 11:51 AM, Alex Wang <alecwang80 at gmail.com> wrote:

  
    
#
Why use glm(...) for a multiple regression?  A multiple regression model
is just an LM, not a GLM.  glm(...) is the long way round, at best.

___

fm <- lm(y ~ x1+x2+..., data = myData)  ## fits the model
summary(fm)            ## will show you the tests, including p-values

pv <- summary(fm)$coef[, "Pr(>|t|)"]  ## will extract them



-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Alex Wang
Sent: Wednesday, 19 March 2008 1:51 PM
To: r-help at r-project.org
Subject: [R] How to get the P-values from GLM results?

Hello all,

  I have a question concerning how to get the P-value for a explanatory
variables based on GLM.

 I'll run multiple regressions with GLM, and I'll need the P-value for
the
same explanatory variable from these multiple GLM results.

 I check the help and there are quite a few Value options but I just
can
not find anyone  about the p-value.

 Could anyone help me with that?

Thanks a lot!

Alex


______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
#
I believe you're looking for summary.  So

my.glm<-glm(Response ~ TrtA*TrtB)
summary(my.glm)

will give you p values for each parameter value.  Similarly anova(my.glm)
will give you p values for the likelihood ratio chi-square statistic for
each factor using sequential tests.  You can also use Anova from the car
library for tests corresponding to a type II sums of squares analysis.