{"uid":"cap_sXrpazkm8agcRh366rak-","slug":"fisher-s-exact-test-2-2-table-34e987e1","name":"Fisher's Exact Test (2×2 Table)","description":"Fisher's exact test for a 2x2 table: two-sided and one-sided p-values from the hypergeometric distribution, plus odds ratio.","url":"https://stats-tests.x402tookit.com/fisher-exact?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["a","b","c","d"],"properties":{"a":{"type":"integer","description":"Row 1, column 1 count"},"b":{"type":"integer","description":"Row 1, column 2 count"},"c":{"type":"integer","description":"Row 2, column 1 count"},"d":{"type":"integer","description":"Row 2, column 2 count"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"table":{"type":["array","null"],"items":{"type":"array","items":{"type":"number"}}},"total":{"type":["null","number"]},"source":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"pValueLess":{"type":["null","number"]},"pValueGreater":{"type":["null","number"]},"pValueTwoSided":{"type":["null","number"]},"sampleOddsRatio":{"type":["null","number"]},"significantAt5pct":{"type":["boolean","null"]},"probabilityOfObservedTable":{"type":["null","number"]}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_0zEEYZaGjvcvlg-ptkwds","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes two-sided and one-sided p-values via the hypergeometric distribution and the sample odds ratio for a 2×2 contingency table using Fisher's exact test.","exampleAgentPrompt":"Run Fisher's exact test on this 2x2 table: 12 successes and 5 failures in the treatment group, and 3 successes and 14 failures in the control group — give me the two-sided p-value and odds ratio.","exampleUseCases":[{"title":"Clinical trial response rate comparison","prompt":"I ran a small drug trial — 8 patients responded and 4 didn't in the treatment arm, and 2 responded and 10 didn't in the placebo arm. Can you run Fisher's exact test and tell me if the difference is statistically significant, with the two-sided p-value and odds ratio?"},{"title":"A/B test conversion significance check","prompt":"In my A/B test, variant A had 45 conversions out of 55 shown, and variant B had 30 conversions out of 50 shown. Run Fisher's exact test on those four counts and tell me the p-values and odds ratio."},{"title":"Genetic association study","prompt":"For my genetics data, 18 cases had the risk allele and 7 didn't, while 5 controls had the risk allele and 20 didn't. What does Fisher's exact test say — is the association significant, and what's the odds ratio?"}],"resultDescription":"Returns the two-sided p-value, one-sided p-values (less and greater), the sample odds ratio, the probability of the observed table under the null hypothesis, and a flag indicating whether the result is significant at the 5% level.","failureModes":["Missing any of the four required integer counts (a, b, c, d) results in a validation error","Non-integer or negative cell counts will be rejected","All-zero marginals (e.g., an entire row or column is zero) may produce undefined odds ratio","Very large counts may produce floating-point precision edge cases"],"whenToPreferThis":"Choose this endpoint when you have a 2×2 contingency table with small expected cell counts (where chi-square approximations are unreliable), or when you need exact p-values from the hypergeometric distribution rather than asymptotic approximations. It is ideal for clinical trials, genetic association studies, and any binary exposure/outcome setup with limited sample sizes.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T07:20:17.083Z","isFirstParty":false,"canonicalSlug":"fisher-s-exact-test-2-2-table-34e987e1"}