TOMS434
Exact Probabilities for RxC Contingency Tables
TOMS434
is a FORTRAN77 library which
implements ACM TOMS algorithm 434, for determining
exact probabilities of RxC contingency tables.
While the text of many ACM TOMS algorithms is available online
through ACM:
http://www.acm.org/pubs/calgo
or NETLIB:
http://www.netlib.org/toms/index.html, most of the early
algorithms are not available. This is one of them. I typed it
in.
Usage:

call conp ( matrix, nr, nc, pt, ps, pc )

where MATRIX, is an NR by NC array, containing
row sums in the last column and column sums in the last row,
and a grand total in the last row and column; PT is the
probability of obtaining the given table, PS the probability
of obtaining a table as probable as, or less probable than, the
given table, and PC is the probability of obtaining any
one of the tables with the constraints of the marginal totals,
which should be 1.0 exactly, but whose actual value reflects
the accuracy of the computation.
Languages:
TOMS434 is available in
a FORTRAN77 version.
Reference:

David March,
Algorithm 434: Exact Probabilities for RxC Contingency Tables,
Communications of the ACM,
Volume 15, Number 11, November 1972, pages 991992.
Source Code:
Examples and Tests:
List of Routines:

CONP determines the exact probability of an
RxC contingency table.

FACLOG computes the logarithm base 10 of N factorial.
You can go up one level to
the FORTRAN77 source codes.
Last revised on 07 December 2005.