Calculation for Fisher's Exact Test

An interactive calculation tool for Fisher's exact probability test for 2 x 2 tables

© 2010-2024,

Kristopher J. Preacher

Kristopher J. Preacher

Calculation for Fisher's Exact Test: An interactive calculation tool for Fisher's exact probability test for 2 x 2 tables

Kristopher J. Preacher (*Vanderbilt University*)

Nancy E. Briggs (*Ohio State University*)

This web utility may be cited in APA style in the following manner:

Preacher, K. J., & Briggs, N. E. (2001, May). Calculation for Fisher's Exact Test: An interactive calculation tool for Fisher's exact probability test for 2 x 2 tables [Computer software]. Available from http://quantpsy.org.

This web page is intended to provide a brief introduction to Fisher's exact test of independence for 2 x 2 tables. This test is used to detect group differences using frequency (count) data. This page also provides an interactive tool allowing researchers to conduct Fisher's exact test for their own research. Following is a condensed introduction.

The Fisher exact test for 2 x 2 tables is used when members of two independent groups can fall into one of two mutually exclusive categories. The test is used to determine whether the proportions of those falling into each category differ by group. The chi-square test of independence can also be used in such situations, but it is only an approximation, whereas Fisher's exact test returns exact one-tailed and two-tailed *p*-values for a given frequency table.

The probability of observing a given set of frequencies __A__, __B__, __C__, and __D__ in a 2 x 2 contingency table, given fixed row and column marginal totals and sample size *N*, is:

Fisher's exact test computes the probability, given the observed marginal frequencies, of obtaining exactly the frequencies observed * and any configuration more extreme*. By "more extreme," we mean any configuration (given observed marginals) with a smaller probability of occurrence in the same direction (one-tailed) or in both directions (two-tailed). Thus, if your 2 x 2 frequency table is:

then all configurations with the same marginal frequencies include:

with corresponding probabilities:

Those tables outlined in yellow constitute the configurations more extreme than the observed configuration in the same direction. More extreme configurations in the same direction are identified by locating the smallest frequency in the table, subtracting 1, and then computing the remaining items given the observed marginal frequencies. Those tables outlined in green are the configurations more extreme in the *opposite* direction. Extremity is defined in terms of probability, so the probability of any configuration to the right of the table of observed frequencies with probability less than or equal to that of the observed configuration are added to the total probability of more extreme configurations.

Thus, the one-tailed probability for this table would be:

.326 + .093 + .007 = .426

...whereas the two-tailed probability would be:

.326 + .093 + .007 + .163 + .019 = .608

The probability for the fourth configuration is not included because it is less extreme (more probable) than the observed frequency configuration.

Type your observed frequencies into the four upper left cells of the table below, then click on "Calculate." The status bar at the bottom will tell you if there is an error of some sort.

If you get a "Stack overflow" error, see "NaN" in the output boxes, or get no results at all when you click on "Calculate," your frequencies are probably too large for the program to handle. Consider instead using the chi-square approximation with Yates' correction for continuity.

Original version posted May, 2001. We wish to thank Frank Tola for extensive and thorough testing. Free JavaScripts provided by The JavaScript Source and John C. Pezzullo.