Hi, I noted a discrepancy between R and openepi when I ran a fisher test with the same matrix. In R: > a=matrix(c(1,2,6,17), nrow=2) > a [,1] [,2] [1,] 1 6 [2,] 2 17 > fisher.test(a, conf.int=T) Fisher's Exact Test for Count Data data: a p-value = 1 alternative hypothesis: true odds ratio is not equal to 1 95 percent confidence interval: 0.02061498 31.73691924 sample estimates: odds ratio 1.396646 But in openepi the P value is 1.25. (In another instance too for other sets of data, I had got a p value of 1 in 3 instances for a prop.test when I got 3 other answers on a friend's stata software with the same data. ) I'm using R on Ubuntu Intrepid. Is there anything I'm doing wrong? Any other packages I have to install? Thanks in advance Viju Moses
Viju Moses, Are you sure you got a P-value of 1.25 ? Since P-value could only be between 0 to 1... Tal On Sat, Mar 21, 2009 at 9:17 PM, Viju Moses <vijumoses@gmail.com> wrote:> Hi, I noted a discrepancy between R and openepi when I ran a fisher test > with the same matrix. In R: > > > a=matrix(c(1,2,6,17), nrow=2) > > a > [,1] [,2] > [1,] 1 6 > [2,] 2 17 > > fisher.test(a, conf.int=T) > > Fisher's Exact Test for Count Data > > data: a > p-value = 1 > alternative hypothesis: true odds ratio is not equal to 1 > 95 percent confidence interval: > 0.02061498 31.73691924 > sample estimates: > odds ratio > 1.396646 > > But in openepi the P value is 1.25. (In another instance too for other sets > of data, I had got a p value of 1 in 3 instances for a prop.test when I got > 3 other answers on a friend's stata software with the same data. ) > > I'm using R on Ubuntu Intrepid. Is there anything I'm doing wrong? Any > other packages I have to install? > > Thanks in advance > > Viju Moses > > ______________________________________________ > 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. >-- ---------------------------------------------- My contact information: Tal Galili Phone number: 972-50-3373767 FaceBook: Tal Galili My Blogs: http://www.r-statistics.com/ http://www.talgalili.com http://www.biostatistics.co.il [[alternative HTML version deleted]]
Let me ask you: What degree of credibility should be accorded a WWW application that delivers a p-value of 1.25? If the answer is not immediately and glaringly obvious, then tell us, what sort of axioms of probability are you working with? -- David Winsemius On Mar 21, 2009, at 3:17 PM, Viju Moses wrote:> Hi, I noted a discrepancy between R and openepi when I ran a fisher > test with the same matrix. In R: > > > a=matrix(c(1,2,6,17), nrow=2) > > a > [,1] [,2] > [1,] 1 6 > [2,] 2 17 > > fisher.test(a, conf.int=T) > > Fisher's Exact Test for Count Data > > data: a > p-value = 1 > alternative hypothesis: true odds ratio is not equal to 1 > 95 percent confidence interval: > 0.02061498 31.73691924 > sample estimates: > odds ratio > 1.396646 > > But in openepi the P value is 1.25. (In another instance too for > other sets of data, I had got a p value of 1 in 3 instances for a > prop.test when I got 3 other answers on a friend's stata software > with the same data. ) > > I'm using R on Ubuntu Intrepid. Is there anything I'm doing wrong? > Any other packages I have to install? > > Thanks in advance > > Viju Moses > > ______________________________________________ > 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.David Winsemius, MD Heritage Laboratories West Hartford, CT
by definition, the one tailed p-value has to be <= 0.5 so there is still something wrong with your OpenEpi calc. Most likely it's calculating the 2 tailed p-value and then mistakenly multiplying by 2. For example: A) Suppose you are testing Ho: u = u_0 H1 u > u_0 and your t-stat was -0.3 Then prob( T > t_0) = 0.62 so your pvalue would be 0.62. B) Instead, suppose you are testing Ho: u = u_0 H1 u != u_0 and your t-stat was -0.3. Then, one calculates, prob(T < t_0 = -.3) = .31 and then multiplies by 2 ( because the test is 2 sided ) so the pvalue is still 0.62. So, it's probably doing the first case andf them multiplying it by 2 which is incorrect. Also, no offense intended but it's dangerous to use these things unless the understanding is there. In fact, it can be dangerous to use them even when the understanding is there !!!!!!! Peter Daalgard's book or John Verzani's book are probably decent recommendations to read for the above kind of thing but an introduction to statistical testing textbook is probably most useful. I can't think of a title at the moment. On Sat, Mar 21, 2009 at 9:07 PM, C.H. wrote:> I tried the OpenEpi, the p-value of 1.25 is due to the fact that the > one tailed p-value is 0.62. The two tailed p-value then is 0.62 * 2 > 1.25. OpenEpi is not clever enough to ceiling the p-value to 1. > > CH > > On Sun, Mar 22, 2009 at 3:43 AM, David Winsemius > <dwinsemius at comcast.net> wrote: >> Let me ask you: What degree of credibility should be accorded a WWW >> application that delivers a p-value of 1.25? >> >> If the answer is not immediately and glaringly obvious, then tell us, >> what >> sort of axioms of probability are you working with? >> >> -- >> David Winsemius >> On Mar 21, 2009, at 3:17 PM, Viju Moses wrote: >> >>> Hi, I noted a discrepancy between R and openepi when I ran a fisher >>> test >>> with the same matrix. In R: >>> >>>> a=matrix(c(1,2,6,17), nrow=2) >>>> a >>> ? [,1] [,2] >>> [1,] ? ?1 ? ?6 >>> [2,] ? ?2 ? 17 >>>> fisher.test(a, conf.int=T) >>> >>> ? ? ?Fisher's Exact Test for Count Data >>> >>> data: ?a >>> p-value = 1 >>> alternative hypothesis: true odds ratio is not equal to 1 >>> 95 percent confidence interval: >>> 0.02061498 31.73691924 >>> sample estimates: >>> odds ratio >>> 1.396646 >>> >>> But in openepi the P value is 1.25. (In another instance too for >>> other >>> sets of data, I had got a p value of 1 in 3 instances for a >>> prop.test when I >>> got 3 other answers on a friend's stata software with the same data. >>> ) >>> >>> I'm using R on Ubuntu Intrepid. Is there anything I'm doing wrong? >>> Any >>> other packages I have to install? >>> >>> Thanks in advance >>> >>> Viju Moses >>> >>> ______________________________________________ >>> 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. >> >> David Winsemius, MD >> Heritage Laboratories >> West Hartford, CT >> >> ______________________________________________ >> 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. >> > > > > -- > CH Chan > Research Assistant - KWH > http://www.macgrass.com > > ______________________________________________ > 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.
thanks ben: i think my example makes sense but my terminology of one tailed two tailed was wrong or flipped or whatever. in fact, that's why i gave the example. i wasn't remembering the terminology because it's been too long since i stepped in a classroom ( 8 years ). On Sat, Mar 21, 2009 at 10:42 PM, Ben Bolker wrote:> <markleeds <at> verizon.net> writes: > >> >> by definition, the one tailed p-value has to be <= 0.5 so there is >> still something wrong with your OpenEpi calc. Most likely it's >> calculating the >> 2 tailed p-value and then mistakenly multiplying by 2. For example: > > For what it's worth, Fisher's exact test with alternative="greater" > (true odds ratio is > 1) does give 0.6273 in R. (Why does a one-tailed > test have to have p<=0.5? The probability that a test statistic > is greater than some null-hypothesis value can be anywhere > between 0 and 1 ...) It is a 1-tailed test, > but (as has been pointed out) multiplying it by 2 without > truncating at 1 is wrong. > > Ben Bolker > > ______________________________________________ > 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.
Thanks berwin. See what I sent to Ben. I better start looking up my stat textbooks or going back to class before I start using stat terms. You guys are on top of things !!!!. On Sat, Mar 21, 2009 at 10:50 PM, Berwin A Turlach wrote:> G'day Mark, > > On Sat, 21 Mar 2009 22:08:21 -0500 (CDT) > markleeds at verizon.net wrote: > >> by definition, the one tailed p-value has to be <= 0.5 > > Can you point me to such a definition? I was not aware that this is > the case. :) > > And your example: > >> A) Suppose you are testing >> >> Ho: u = u_0 >> H1 u > u_0 >> >> and your t-stat was -0.3 Then prob( T > t_0) = 0.62 so your pvalue >> would be 0.62. > > seems to contradict your statement. A one sided-test, hence a > one-tailed p-value, which yields a p-value larger than 0.5. > > But, perhaps, we are just using different terminology. > > Cheers, > > Berwin