The purpose of this email is to
(1) report an example where fisher.test returns p > 1
(2) ask if there is a reliable way to avoid p>1 with fisher.test.
If one has designed one's code to return an error when it finds a "nonsensical"
probability, of course a value of p>1 can cause havoc.
Example:
junk<-data.frame(score=c(rep(0,14), rep(1,29), rep(2, 16)))
junk<-rbind(junk, junk)
junk$group<-c(rep("DOG", nrow(junk)/2), rep("kitty", nrow(junk)/2))
table(junk$score, junk$group)
DOG kitty
0 14 14
1 29 29
2 16 16
dput(fisher.test(junk$score, junk$group)$p.value)
1.00000000000012
dput(fisher.test(junk$score, junk$group, simulate.p.value=TRUE)$p.value)
1
In this particular case, specifying a simulated p value solved the problem. But is
there a reliable way to avoid p>1 in general?
sessionInfo()
R version 2.10.1 (2009-12-14)
x86_64-apple-darwin9.8.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_2.10.1
Thanks for any insight
Jacob A. Wegelin
Assistant Professor
Department of Biostatistics
Virginia Commonwealth University
730 East Broad Street Room 3006
P. O. Box 980032
Richmond VA 23298-0032
U.S.A.
______________________________________________
R-help@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.