{"uid":"cap_IyZLAVQxstN1bjei1Uv0D","slug":"statistical-tests-effect-size-from-2-2-table-d5c88e92","name":"Statistical Tests – Effect Size from 2×2 Table","description":"Odds ratio, relative risk, risk difference and number needed to treat from a 2x2 table, each with a confidence interval.","url":"https://stats-tests.x402tookit.com/effect-size-2x2?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":["exposedEvents","exposedNoEvents","unexposedEvents","unexposedNoEvents"],"properties":{"confidence":{"type":"number","description":"0.8 to 0.999 (default 0.95)"},"exposedEvents":{"type":"integer","description":"Events in the exposed (or treated) group"},"exposedNoEvents":{"type":"integer","description":"Non-events in the exposed group"},"unexposedEvents":{"type":"integer","description":"Events in the unexposed (or control) group"},"unexposedNoEvents":{"type":"integer","description":"Non-events in the unexposed group"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"source":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"direction":{"type":["null","string"]},"oddsRatio":{"type":["null","number"]},"confidence":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"oddsRatioCI":{"type":["null","object"],"properties":{"lower":{"type":["null","number"]},"upper":{"type":["null","number"]}}},"riskExposed":{"type":["null","number"]},"relativeRisk":{"type":["null","number"]},"riskUnexposed":{"type":["null","number"]},"relativeRiskCI":{"type":["null","object"],"properties":{"lower":{"type":["null","number"]},"upper":{"type":["null","number"]}}},"riskDifference":{"type":["null","number"]},"riskDifferenceCI":{"type":["null","object"],"properties":{"lower":{"type":["null","number"]},"upper":{"type":["null","number"]}}},"correctionApplied":{"type":["boolean","null"]},"numberNeededToTreat":{"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_-2RC_49erF_zfh2E1NKTr","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 odds ratio, relative risk, risk difference, and number needed to treat with confidence intervals from a 2×2 contingency table of exposed/unexposed event counts.","exampleAgentPrompt":"Calculate the odds ratio, relative risk, risk difference, and number needed to treat for a study where 45 out of 200 exposed people had the event and 20 out of 200 unexposed people had the event, using a 95% confidence interval.","exampleUseCases":[{"title":"Clinical trial treatment effect analysis","prompt":"I ran a randomized trial: 38 patients in the treatment group had the adverse event and 162 did not; in the control group 57 had it and 143 did not. Give me the odds ratio, relative risk, and risk difference all with 95% confidence intervals."},{"title":"Vaccine efficacy from case-control data","prompt":"In our vaccine study, 12 vaccinated people got sick out of 500 and 87 unvaccinated people got sick out of 500. Can you compute the relative risk, odds ratio, and number needed to vaccinate to prevent one case? Use a 99% confidence level."},{"title":"Occupational exposure risk assessment","prompt":"We found 25 events among 180 workers exposed to the chemical and 9 events among 220 unexposed workers. What is the risk difference and relative risk with 90% confidence intervals, and what's the number needed to treat?"}],"resultDescription":"Returns odds ratio, relative risk, risk difference, and number needed to treat, each with lower and upper confidence interval bounds. Also includes the raw risk in each group, a summary verdict, direction of effect, and optional disclaimer or data quality flags.","failureModes":["Missing required cell counts (exposedEvents, exposedNoEvents, unexposedEvents, unexposedNoEvents) returns validation error","Zero cell counts can cause undefined odds ratio or division-by-zero for relative risk","Confidence level outside 0.8–0.999 range may be rejected or clamped to defaults","Negative integer inputs will be rejected","Very small cell counts may produce extremely wide confidence intervals that are statistically unreliable"],"whenToPreferThis":"Choose this endpoint when you have a completed 2×2 contingency table from an observational or experimental study and need all four canonical effect size measures (OR, RR, RD, NNT) with confidence intervals in a single call. Prefer this over Fisher's exact test sibling when the goal is effect size estimation rather than p-value hypothesis testing, and over chi-square when you need magnitude and direction of effect rather than just independence.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T07:20:35.254Z","isFirstParty":false,"canonicalSlug":"statistical-tests-effect-size-from-2-2-table-d5c88e92"}