[R] Extract p value from aov
Dimitris Rizopoulos
dimitris.rizopoulos at med.kuleuven.be
Mon Oct 9 13:45:35 CEST 2006
the following seems to work:
test.summary$"Error: Within"[[1]]$"Pr(>F)"
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Jim Lemon" <jim at bitwrit.com.au>
To: "r-help" <r-help at stat.math.ethz.ch>
Sent: Tuesday, October 10, 2006 3:25 AM
Subject: [R] Extract p value from aov
> Hi all,
>
> In assessing the concordance of two sets of ANOVA results, I would
> like
> to extract the p values from the summaries. I had a look at previous
> answers to this problem, and the suggestions do not seem to work:
>
> # toy example
> test.df<-data.frame(subno=c(1:50,1:50),
> ndrinks=c(rpois(50,4.5),rpois(50,4)),
> b4after=c(rep(1,50),rep(-1,50)))
> test.summary<-summary(aov(ndrinks~b4after+Error(subno),test.df))
> test.summary[[2]][,5]
> Error in test.summary[[2]][, 5] : incorrect number of dimensions
>
> and so on.
>
> I can get the structure of the object:
>
> str(test.summary[[2]])
> List of 1
> $ :Classes anova and `data.frame': 2 obs. of 5 variables:
> ..$ Df : num [1:2] 1 269
> ..$ Sum Sq : num [1:2] 60.2 1792.0
> ..$ Mean Sq: num [1:2] 60.24 6.66
> ..$ F value: num [1:2] 9.04 NA
> ..$ Pr(>F) : num [1:2] 0.00289 NA
> - attr(*, "class")= chr [1:2] "summary.aov" "listof"
>
> but if I try to extract it:
>
> test.summary[[2]]$'Pr(>F)'
> NULL
>
> I assume that the incantation has changed.
>
> Using R-2.3.1 - Tried this on both Windows XP and FC4 Linux
>
> Jim
>
> ______________________________________________
> 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.
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
More information about the R-help
mailing list