fisher_exact_test
Test independence in a 2x2 table using the exact hypergeometric method when chi-square assumptions fail due to small samples. Returns odds ratio, p-value, and citation.
Instructions
Test whether the row and column variables of a 2x2 contingency
table are independent -- exact (via the hypergeometric distribution
over all tables with the same margins), unlike
chi_square_independence's chi-squared approximation. Use this
instead whenever chi_square_independence warns an expected cell
count is below 5, or whenever the sample is small. 2x2 tables only.
Returns the sample odds ratio as statistic (can be inf/0 for a
zero cell), a two-tailed p-value, a citation, and warnings.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| alpha | No | significance level for the test (and any confidence interval); default 0.05 | |
| table | Yes | 2x2 contingency table as [[a, b], [c, d]], raw non-negative integer counts |