# Re: [R] anova p value extraction

From: H. Paul Benton <hpbenton_at_scripps.edu>
Date: Wed, 07 May 2008 18:40:29 -0700

yep That worked Jorge. Thanks!

summary(pb)\$"Pr(>F)1"
NULL
> summ<-summary(pb)
> class(unlist(summ))

[1] "numeric"
> unlist(summ)["Pr(>F)1"]

Pr(>F)1
0.02533637
> names(summ)

NULL Jorge Ivan Velez wrote:
>
> Hi Paul,
>
> Perhaps
>
> # Data set
> set.seed(123)
> x=rnorm(100)
> y=x+2*rnorm(100)
>
> # ANOVA
> AOV=anova(lm (y ~ x))
> p1=AOV\$"Pr(>F)"[1]
> p1
>
> or
>
> # ANOVA 2
> AOV1=aov(y ~ x)
> p2=unlist(summary(AOV1))["Pr(>F)1"]
> p2
>
>
> HTH,
>
> Jorge
>
>
>
> On Wed, May 7, 2008 at 8:47 PM, Paul Benton <hpbenton_at_scripps.edu
> <mailto:hpbenton_at_scripps.edu>> wrote:
>
> hello all,
>
> Quick question, how do I get the p value out of the anova?
>
> Thanks,
>
> Paul
>
> > pb<-aov(as.numeric(diff[5,16:33]) ~ grF)
> > summary(pb)
> Df Sum Sq Mean Sq F value Pr(>F)
> grF 3 2.7860e+10 9.2867e+09 4.2236 0.02534 *
> Residuals 14 3.0783e+10 2.1988e+09
> ---
> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> > str(summary(pb))
> List of 1
> \$ :Classes 'anova' and 'data.frame': 2 obs. of 5 variables:
> ..\$ Df : num [1:2] 3 14
> ..\$ Sum Sq : num [1:2] 2.79e+10 3.08e+10
> ..\$ Mean Sq: num [1:2] 9.29e+09 2.20e+09
> ..\$ F value: num [1:2] 4.22 NA
> ..\$ Pr(>F) : num [1:2] 0.0253 NA
> - attr(*, "class")= chr [1:2] "summary.aov" "listof"
> > attr(summary(pb), "Pr(>F)")
> NULL
>
> ______________________________________________
> R-help_at_r-project.org <mailto:R-help_at_r-project.org> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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. Received on Thu 08 May 2008 - 01:43:49 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 Thu 08 May 2008 - 02:30:38 GMT.

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