Hi, is there a way to generate the table's probability when doing the fisher's exact test on a 2x2 table? The fisher's exact test gives the p value, but not the probability for the table.
fisher table probability
5 messages · Brian Ripley, array chip
On Wed, 1 Feb 2006, array chip wrote:
Hi, is there a way to generate the table's probability when doing the fisher's exact test on a 2x2 table? The fisher's exact test gives the p value, but not the probability for the table.
Call dhyper, as fisher.test itself does.
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Thanks for the suggestion! what if the dimensions of the table is greater than 2, say 3x4?
--- Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
On Wed, 1 Feb 2006, array chip wrote:
Hi, is there a way to generate the table's
probability
when doing the fisher's exact test on a 2x2 table?
The
fisher's exact test gives the p value, but not the probability for the table.
Call dhyper, as fisher.test itself does. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On Thu, 2 Feb 2006, array chip wrote:
Thanks for the suggestion! what if the dimensions of the table is greater than 2, say 3x4?
Look at the references quoted on the help page for the formula: the simulation code for p-values in R-devel makes use of it and it is easy to compute via lgamma.
--- Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
On Wed, 1 Feb 2006, array chip wrote:
Hi, is there a way to generate the table's
probability
when doing the fisher's exact test on a 2x2 table?
The
fisher's exact test gives the p value, but not the probability for the table.
Call dhyper, as fisher.test itself does. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Thanks for pointing. This is my simple function for
doing this, just like to share if anyone ever needs
it:
## x is a rxc table
tabprob<-function (x) {
tmp<-0
for (i in 1:dim(x)[1]) {
tmp<-tmp+lgamma(sum(x[i,])+1)
for (j in 1:dim(x)[2]) {
if (i==1) tmp<-tmp+lgamma(sum(x[,j])+1)
tmp<-tmp-lgamma(x[i,j]+1)
}
}
tmp<-tmp-lgamma(sum(x)+1)
exp(tmp)
}
--- Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
On Thu, 2 Feb 2006, array chip wrote:
Thanks for the suggestion! what if the dimensions
of
the table is greater than 2, say 3x4?
Look at the references quoted on the help page for the formula: the simulation code for p-values in R-devel makes use of it and it is easy to compute via lgamma.
--- Prof Brian Ripley <ripley at stats.ox.ac.uk>
wrote:
On Wed, 1 Feb 2006, array chip wrote:
Hi, is there a way to generate the table's
probability
when doing the fisher's exact test on a 2x2
table?
The
fisher's exact test gives the p value, but not
the
probability for the table.
Call dhyper, as fisher.test itself does. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
__________________________________________________ Do You Yahoo!?
protection around
-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595