IMSL_EXACT_ENUM

Syntax | Return Value | Arguments | Keywords | Discussion | Example | Version History

The IMSL_EXACT_ENUM function computes exact probabilities in a two-way contingency table using the total enumeration method.

Note
This routine requires an IDL Advanced Math and Stats license. For more information, contact your ITT Visual Information Solutions sales or technical support representative.

Syntax

Result = IMSL_EXACT_ENUM(table [, /DOUBLE] [, ERROR_CHK=variable] [, P_VALUE=variable] [, PROB_TABLE=variable] )

Return Value

The p-value for independence of rows and columns. The p-value represents the probability of a more extreme table where "extreme" is taken in the Neyman-Pearson sense. The p-value is "two-sided".

Arguments

table

Two-dimensional array containing the observed counts in the contingency table.

Keywords

DOUBLE

If present and nonzero, double precision is used.

ERROR_CHK

Named variable into which the sum of the probabilities of all tables with the same marginal totals is stored. Keyword Error_Chk should have a value of 1.0. Deviation from 1.0 indicates numerical error.

P_VALUE

Named variable into which the p-value for independence of rows and columns is stored. The p-value represents the probability of a more extreme table where "extreme" is taken in the Neyman-Pearson sense. The p-value is "two-sided".

The p-value is also returned in functional form (see Returned Value).

A table is more extreme if its probability (for fixed marginals) is less than or equal to Prob_Table.

PROB_TABLE

Named variable into which the probability of the observed table occurring, given that the null hypothesis of independent rows and columns is true, is stored.

Discussion

The IMSL_EXACT_ENUM function computes exact probabilities for an r by c contingency table for fixed row and column marginals (a marginal is the number of counts in a row or column), where r = N_ELEMENTS(table(*,0)) and c = N_ELEMENTS(table(0,*)). Let fij denote the count in row i and column j of a table, and let f and f·j denote the row and column marginals. Under the hypothesis of independence, the (conditional) probability of the fixed marginals of the observed table is given by:

IMSL_EXACT_ENUM-26.jpg

where f·· is the total number of counts in the table. Pf corresponds to output keyword Prob_Table.

A more extreme table X is defined in the probabilistic sense as more extreme than the observed table if the conditional probability computed for table X (for the same marginal sums) is less than the conditional probability computed for the observed table. Note that this definition can be considered "two-sided" in the cell counts.

Because IMSL_EXACT_ENUM uses total enumeration in computing the probability of a more extreme table, the amount of computer time required increases very rapidly with the size of the table. Tables with a large total count f·· or a large value of r by c should not be analyzed using IMSL_EXACT_ENUM. In such cases, try using IMSL_EXACT_NETWORK.

Example

In this example, the exact conditional probability for the 2 by 2 contingency table is computed as follows:

IMSL_EXACT_ENUM-27.jpg

table = [[8, 8], [12, 2]] 
p = IMSL_EXACT_ENUM(table, P_Value=pv, Prob_Table=pt, 
Error_Chk=ec) 
PRINT, 'p-value =', p 
p-value = 0.0576712 

Version History

6.4

Introduced