FEXACT2X2 procedure
Does Fisher's exact test for 2×2 tables (M.S. Ridout & M.W. Patefield).
Option
Parameters
Description
The ostensibly simple problem of testing for association in a 2×2 contingency table has generated a large and disputative literature. Yates (1984) and Hirji, Tan & Elashoff (1991) give excellent reviews. Controversy has centred on Fisher's exact test which conditions on both margins of the 2×2 table; some have argued that this conditioning is appropriate only if both margins of the table are fixed by the sampling design whereas others, Yates included, advocate use of the test irrespective of the sampling design. Consensus of opinion seems to favour the latter viewpoint.
Procedure FEXACT2X2 does the calculations for Fisher's exact test. The TABLE parameter is used to supply to the procedure the four numbers that comprise the 2×2 table, either as a 2×2 GenStat table, with no margins, or as a variate consisting of the four numbers ordered either row by row or column by column.
The procedure calculates the one-tailed significance level that is produced by the exact test. The mid-p value, which includes only half the probability of the observed table, is also calculated. See Hirji, Tan & Elashoff (1991) for a discussion of mid-p values. Several methods have been proposed for calculating a two-tailed significance level, two of which are implemented in the procedure. The first method simply doubles the one-tailed significance level whereas the second method calculates the cumulative probability of all outcomes that are no more probable than the observed table. See Yates (1984) for discussion of these and other methods. The procedure also calculates mid-p values corresponding to each of the two-tailed significance levels. The various probabilities can be saved, in a variate of length six, using the PROBABILITIES parameter.
The procedure has a single option PRINT to control printed output. By default PRINT=probabilities. There is also another setting tables which causes the procedure to display all 2×2 tables with margins that are the same as the observed table together with their probabilities of occurrence under the null hypothesis of no association and the cumulative probabilities calculated from both tails. This display was proposed by Hill (1984).
Option: PRINT. Parameters: TABLE, PROBABILITIES.
Method
The procedure evaluates all 2×2 tables with the same margins as the observed table. The hypergeometric probabilities that are calculated as inversely proportional to the product of factorials of the table elements and then standardized to sum to one.
Action with
RESTRICT
If the values of the 2×2 table are specified as a variate, this must not be restricted.
References
Hirji, K.F., Tan, S. & Elashoff, R.M. (1991). A quasi-exact test for comparing two binomial proportions. Statistics in Medicine, 10, 1137-1153.
Yates, F. (1984). Tests of significance for 2x2 contingency tables. Journal of the Royal Statistical Society, Series A, 147, 426-463.
Hill, I.D. (1984). Contribution to the discussion of Yates (1984). Journal of the Royal Statistical Society, Series A, 147, 452-453.