1. Home
  2. FEXACT2X2 procedure

FEXACT2X2 procedure

Does Fisher’s exact test for 2×2 tables (M.S. Ridout & M.W. Patefield).

Option

PRINT = string tokens Controls printed output (probabilities, tables); default prob

Parameters

TABLE = tables or variates The numbers in each 2×2 table, ordered row by row or column by column
PROBABILITIES = variates Saves the probabilities for each table in a variate of length 6 (to store in positions 1, 3 and 5 one-tailed, two-tailed calculated as twice the one-tailed probability, and as the sum of the probabilities of all tables with probability less than that of the observed table with the corresponding mid-p values stored in positions 2, 4 and 6)

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 2×2 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.

See also

Procedures: CHIPERMTEST, APERMTEST, RPERMTEST.

Commands for: Basic and nonparametric statistics.

Example

CAPTION   'FEXACT2X2 example',\
          'Example 37 from Pearson & Hartley Biometrika Tables, Vol.1, p.74';\
          STYLE=meta,plain
SCALAR    Chan
ENQUIRE   Chan; FILETYPE=output; OUTSTYLE=Style
OUTPUT    [STYLE=plain]
PRINT     !t('            9      6','            3     11'); JUST=left
OUTPUT    [STYLE=#Style]
FEXACT2X2 [PRINT=probability,tables] !(9,6,3,11)
FACTOR    [LEVELS=2; VALUES=2(1,2)] Row
FACTOR    [LEVELS=2; VALUES=(1,2)2] Column
TABLE     [CLASSIFICATION=Row,Column; VALUES=9,6,3,11] Table
FEXACT2X2 Table
Updated on March 8, 2019

Was this article helpful?