Statistics and research
Fisher’s exact test calculator
Exact test for a 2×2 table: two-sided and one-sided p-values, the conditional maximum likelihood odds ratio and its exact confidence interval.
Runs in your browser. What you enter stays on this page and is not uploaded.
Results
- Hypothesis
- two-sided, odds ratio ≠ 1
- p-value
- 0.4857
- Two-sided p (sum of tables no more probable than observed)
- 0.4857
- One-sided p, lower (P(X ≤ a))
- 0.9857
- One-sided p, upper (P(X ≥ a))
- 0.2429
- Probability of the observed table
- 0.22857143
- Sample odds ratio ad / bc
- 9
- Conditional maximum likelihood odds ratio
- 6.4083197
- 95% exact confidence interval
- 0.211736 to 626.244
- Conclusion
- Rows and columns are not shown to be associated (not significant at the 5% level).
| a (row 1, column 1) | Probability | Counts toward two-sided p |
|---|---|---|
| 0 | 0.014285714 | yes |
| 1 | 0.22857143 | yes |
| 2 | 0.51428571 | no |
| 3 | 0.22857143 | yes |
| 4 | 0.014285714 | yes |
As R fisher.test: the two-sided p-value adds the probabilities of all tables with the same margins that are no more likely than the one observed; the odds ratio is the conditional maximum likelihood estimate.
Method and limits
How to use it
Enter the four counts of a 2×2 table: a and b in row 1, c and d in row 2. Use it instead of the chi-square test when expected counts are small, or whenever an exact p-value is wanted.
Formulas
- With all margins fixed, a follows the hypergeometric distribution: P(a) = C(a + b, a) C(c + d, c) / C(n, a + c).
- Two-sided p = sum of the probabilities of all tables with the same margins that are no more likely than the observed one (with R’s relative tolerance 1e-7). One-sided p-values sum one tail.
- Odds ratio: the conditional maximum likelihood estimate from the noncentral hypergeometric distribution, and an exact interval by inverting its tails — R’s fisher.test method, solved here to a tighter tolerance than R’s uniroot (results agree with R to about 4 significant digits).
Assumptions and limits
- Independent observations, each in one cell; the test is conditional on both margins.
- Two-sided p-values from different software can differ slightly because definitions of “more extreme” differ; this tool uses R’s.
- Larger tables are not supported here; use the chi-square test.
Worked example
Fisher’s tea-tasting experiment: a lady identified 3 of 4 cups correctly (table 3, 1, 1, 3). The probability of this table is 16/70 = 0.229; the two-sided p = 0.486 and the one-sided p = 0.243. The conditional odds ratio is 6.41.
References
Related tools
- Chi-square test of independence calculatorChi-square test for a contingency table of counts: expected counts, adjusted residuals, likelihood-ratio G², Cramér’s V and Yates’s correction for 2×2.
- Chi-square goodness-of-fit calculatorTest whether observed category counts fit equal or specified expected proportions, with each category’s contribution and residual.
- Cohen’s kappa calculatorAgreement between two raters beyond chance: Cohen’s κ, linear or quadratic weighted κ, standard error, confidence interval and z-test.
- Effect size calculatorCohen’s d, Hedges’ g and Glass’s Δ from group means, or odds ratio, risk ratio and risk difference from a 2×2 table, each with confidence intervals.
- Standard deviation calculatorPaste data to get the standard deviation (sample and population), variance, mean, median, mode, quartiles with the method stated, IQR, outliers, skewness and kurtosis.
- T-test calculatorOne-sample, independent two-sample (Welch and pooled) and paired t-tests from raw data or summary statistics, with confidence intervals and Cohen’s d.