[R] fisher.test, chisq.test

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Fri Nov 9 20:00:05 CET 2007


On Fri, 9 Nov 2007, Denis Aydin wrote:

> Hi,
>
> I want to analyse a contigency table (3 x 12) with a fisher.test
> beacause there are cells that are less than 5.

...expected cells. Anyways, your data set yields a statistic > 160
and I wouldn't worry that this could be the result of random variation
under the null hypothesis. Also looking at the data, e.g., via a
spineplot() of the (transposed) table would clearly indicate a deviation
from the null hypothesis.

>         Ämmen Anken Baf Belchen Höchi Hof Porti Räm Schmutz Schön Sissa Tann
> class14     7    26 150       2    46  68   126  66       3    31     7   61
> class24     7     6  55       5    49  71    93  90       1    18    16   79
> class34     1     1   4       3    19   8    29  61       4     4     5   37
>
> So in made a matrix and used
>
> >fisher.test(classtable4).
>
> But then this error occurs:
>
> Fehler in fisher.test(classtable4) : FEXACT error 7.
> LDSTP is too small for this problem.
> Try increasing the size of the workspace.
>
> Well I then increased the workspace:
>
> >fisher.test(classtable4, workspace=1e8)
>
> But then the same error occurs.

You don't really want/need the exact distribution...

> Do someone knows an alternative to the fisher.test or the chisq.test?

Both functions have an argument simulate.p.value which you could set to
TRUE, possibly increasing B (the number of replications). Even with a
million replications (under independence) I did not obtain a single one
that was larger than the observed statistic. So I think it is pretty safe
to reject independence...

hth,
Z



More information about the R-help mailing list