Cressoni, Massimo (NIH/NHLBI) [F]
2007-Mar-09 16:18 UTC
[R] Extracting the p of F statistics from lm
I need to extract the p value from a ANOVA done with lm model fitting <- lm(var ~ group) Sfitting <- summary(fitting) Sfitting[10][1] gives the F value and the degrees of freedom but I am not able to get the p value. The function df should give a p value given a F but I am not able to make it work. I found only something about aov in the R help and I am not able to make it work Massimo Cressoni
> Date: Fri, 09 Mar 2007 11:18:46 -0500 > From: "Cressoni, Massimo (NIH/NHLBI) [F]" <cressonim at nhlbi.nih.gov> > Sender: r-help-bounces at stat.math.ethz.ch > Precedence: list > Thread-topic: Extracting the p of F statistics from lm > Thread-index: AcdiZp1fE6s6LWieSsaL2EpoQP/shg=> > I need to extract the p value from a ANOVA done with lm model > > fitting <- lm(var ~ group) > Sfitting <- summary(fitting) > > Sfitting[10][1] gives the F value and the degrees of freedom but I am not able to get the > p value. > The function df should give a p value given a F but I am not > able to make it work.The function pf should.> > I found only something about aov in the R help and I am not able > to make it work > > Massimo Cressoni > > ______________________________________________ > R-help at stat.math.ethz.ch 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. > >-- Giovanni Petris <GPetris at uark.edu> Department of Mathematical Sciences University of Arkansas - Fayetteville, AR 72701 Ph: (479) 575-6324, 575-8630 (fax) http://definetti.uark.edu/~gpetris/
On Mar 9, 2007, at 11:18 AM, Cressoni, Massimo ((NIH/NHLBI)) [F] wrote:> I need to extract the p value from a ANOVA done with lm model > > fitting <- lm(var ~ group) > Sfitting <- summary(fitting) > > Sfitting[10][1] gives the F value and the degrees of freedom but I > am not able to get the > p value.try Sfitting[4]$coefficients[,4] I'm not sure that this is the best way, but it works with the example for lm() > summary(lm.D9)[4]$coefficients[,4] # (Intercept) groupTrt # 9.547128e-15 2.490232e-01 _____________________________ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400 Charlottesville, VA 22904-4400 Parcels: Room 102 Gilmer Hall McCormick Road Charlottesville, VA 22903 Office: B011 +1-434-982-4729 Lab: B019 +1-434-982-4751 Fax: +1-434-982-4766 WWW: http://www.people.virginia.edu/~mk9y/