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: or NETLIB:, most of the early algorithms are not available. This is one of them. I typed it in.


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.


TOMS434 is available in a FORTRAN77 version.


  1. David March,
    Algorithm 434: Exact Probabilities for RxC Contingency Tables,
    Communications of the ACM,
    Volume 15, Number 11, November 1972, pages 991-992.

Source Code:

Examples and Tests:

List of Routines:

You can go up one level to the FORTRAN77 source codes.

Last revised on 07 December 2005.