{"success":true,"version":"v1","request":{"tool":"get_calculator_schema","calculator_id":"odds-ratio"},"result":{"entity_type":"calculator","id":"odds-ratio","calculator_id":"odds-ratio","canonical_url":"https://tttkmbb.com/statistics/odds-ratio","name":"Odds Ratio Calculator","title":"Odds Ratio Calculator – OR, Relative Risk, Confidence Intervals and NNT from a 2×2 Table","category":"statistics","category_name":"Statistics & Probability","tool_name":"calculate_odds_ratio","featured_mcp_tool":false,"description":"Computes the odds ratio and relative risk of a 2×2 exposure/outcome table with confidence intervals by the log method (Woolf), plus the absolute risk difference and the number needed to treat or harm.","use_when":"You have counts of events and non-events in an exposed/treated group and an unexposed/control group (case-control or cohort data, clinical trials) and need OR, RR or NNT.","do_not_use_when":"You need a significance test for the table (use chi-square-test), the outcome is continuous (use cohens-d), or you want predictive values of a diagnostic test (use diagnostic-test).","inputs":[{"name":"a","label":"Exposed with outcome (a)","type":"integer","required":true,"min":0,"description":"Exposed / treated group: number with the outcome (events).","example":20},{"name":"b","label":"Exposed without outcome (b)","type":"integer","required":true,"min":0,"description":"Exposed / treated group: number without the outcome.","example":80},{"name":"c","label":"Unexposed with outcome (c)","type":"integer","required":true,"min":0,"description":"Unexposed / control group: number with the outcome.","example":10},{"name":"d","label":"Unexposed without outcome (d)","type":"integer","required":true,"min":0,"description":"Unexposed / control group: number without the outcome.","example":90},{"name":"confidence_level_percent","label":"Confidence level","type":"number","unit":"%","required":false,"default":95,"exclusive_min":0,"exclusive_max":100,"description":"Confidence level in percent (commonly 90, 95 or 99). Determines the critical z value.","example":95}],"outputs":[{"name":"odds_ratio","label":"Odds ratio","type":"number","decimals":4,"description":"(a·d) / (b·c): odds of the outcome in the exposed relative to the unexposed group."},{"name":"or_ci_lower","label":"OR CI lower","type":"number","decimals":4,"description":"Lower confidence limit of the OR (log method)."},{"name":"or_ci_upper","label":"OR CI upper","type":"number","decimals":4,"description":"Upper confidence limit of the OR."},{"name":"relative_risk","label":"Relative risk","type":"number","decimals":4,"description":"(a/(a+b)) / (c/(c+d)): risk in the exposed divided by risk in the unexposed (cohort / trial data only)."},{"name":"rr_ci_lower","label":"RR CI lower","type":"number","decimals":4,"description":"Lower confidence limit of the RR (log method)."},{"name":"rr_ci_upper","label":"RR CI upper","type":"number","decimals":4,"description":"Upper confidence limit of the RR."},{"name":"risk_exposed","label":"Risk in exposed","type":"number","decimals":4,"description":"a / (a + b)."},{"name":"risk_unexposed","label":"Risk in unexposed","type":"number","decimals":4,"description":"c / (c + d)."},{"name":"risk_difference","label":"Absolute risk difference","type":"number","decimals":4,"description":"risk_exposed − risk_unexposed (positive = exposure increases risk)."},{"name":"nnt","label":"NNT / NNH","type":"number","decimals":1,"description":"1 / |risk_difference|: people to treat (benefit) or expose (harm) for one additional outcome; conventionally rounded up. Omitted when the risks are equal."},{"name":"nnt_type","label":"NNT type","type":"string","decimals":4,"description":"'NNT (benefit)' when the exposure lowers risk, 'NNH (harm)' when it raises it."},{"name":"interpretation","label":"Interpretation","type":"string","decimals":4,"description":"Direction of the association and whether the OR interval excludes 1."}],"input_schema":{"type":"object","properties":{"a":{"description":"Exposed / treated group: number with the outcome (events).","type":"integer","minimum":0,"examples":[20]},"b":{"description":"Exposed / treated group: number without the outcome.","type":"integer","minimum":0,"examples":[80]},"c":{"description":"Unexposed / control group: number with the outcome.","type":"integer","minimum":0,"examples":[10]},"d":{"description":"Unexposed / control group: number without the outcome.","type":"integer","minimum":0,"examples":[90]},"confidence_level_percent":{"description":"Confidence level in percent (commonly 90, 95 or 99). Determines the critical z value. Unit: %.","type":"number","exclusiveMinimum":0,"exclusiveMaximum":100,"default":95,"examples":[95],"x-unit":"%"}},"additionalProperties":false,"required":["a","b","c","d"]},"output_schema":{"type":"object","properties":{"odds_ratio":{"description":"(a·d) / (b·c): odds of the outcome in the exposed relative to the unexposed group.","type":"number"},"or_ci_lower":{"description":"Lower confidence limit of the OR (log method).","type":"number"},"or_ci_upper":{"description":"Upper confidence limit of the OR.","type":"number"},"relative_risk":{"description":"(a/(a+b)) / (c/(c+d)): risk in the exposed divided by risk in the unexposed (cohort / trial data only).","type":"number"},"rr_ci_lower":{"description":"Lower confidence limit of the RR (log method).","type":"number"},"rr_ci_upper":{"description":"Upper confidence limit of the RR.","type":"number"},"risk_exposed":{"description":"a / (a + b).","type":"number"},"risk_unexposed":{"description":"c / (c + d).","type":"number"},"risk_difference":{"description":"risk_exposed − risk_unexposed (positive = exposure increases risk).","type":"number"},"nnt":{"description":"1 / |risk_difference|: people to treat (benefit) or expose (harm) for one additional outcome; conventionally rounded up. Omitted when the risks are equal.","type":"number"},"nnt_type":{"description":"'NNT (benefit)' when the exposure lowers risk, 'NNH (harm)' when it raises it.","type":"string"},"interpretation":{"description":"Direction of the association and whether the OR interval excludes 1.","type":"string"}}},"formula":"OR = a·d / (b·c); SE(ln OR) = √(1/a + 1/b + 1/c + 1/d); CI = exp(ln OR ± z·SE). RR = (a/(a+b)) / (c/(c+d)); SE(ln RR) = √(1/a − 1/(a+b) + 1/c − 1/(c+d)); ARD = a/(a+b) − c/(c+d); NNT = 1/|ARD|","method":"Confidence intervals use the Woolf logit method with the normal critical value. If any cell is 0, 0.5 is added to every cell (Haldane–Anscombe correction) for OR, RR and their intervals, and a note is returned. Relative risk is only meaningful for cohort or trial designs, not case-control sampling.","sources":[{"name":"Bland JM, Altman DG (2000) Statistics Notes: The odds ratio, BMJ 320:1468","url":"https://www.bmj.com/content/320/7247/1468","type":"peer_reviewed","retrieved_at":"2026-09-24"},{"name":"Altman DG (1998) Confidence intervals for the number needed to treat, BMJ 317:1309-1312","url":"https://www.bmj.com/content/317/7168/1309","type":"peer_reviewed","retrieved_at":"2026-09-24"},{"name":"Wikipedia – Odds ratio","url":"https://en.wikipedia.org/wiki/Odds_ratio","type":"reference","retrieved_at":"2026-09-24"}],"freshness":{"type":"static","max_age_seconds":null,"note":"Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output."},"examples":[{"name":"Exposed 20/100 events, unexposed 10/100","inputs":{"a":20,"b":80,"c":10,"d":90},"expected":{"odds_ratio":2.25,"or_ci_lower":0.9943,"or_ci_upper":5.0915,"relative_risk":2,"rr_ci_lower":0.9866,"rr_ci_upper":4.0545,"risk_exposed":0.2,"risk_unexposed":0.1,"risk_difference":0.1,"nnt":10,"nnt_type":"NNH (harm)"},"url":"https://tttkmbb.com/api/v1/calculate/odds-ratio?a=20&b=80&c=10&d=90"},{"name":"Treatment 15/100 events vs control 30/100","inputs":{"a":15,"b":85,"c":30,"d":70},"expected":{"odds_ratio":0.4118,"or_ci_lower":0.2053,"or_ci_upper":0.8258,"relative_risk":0.5,"rr_ci_lower":0.2872,"rr_ci_upper":0.8704,"risk_difference":-0.15,"nnt":6.7,"nnt_type":"NNT (benefit)"},"url":"https://tttkmbb.com/api/v1/calculate/odds-ratio?a=15&b=85&c=30&d=70"}],"faq":[{"q":"Odds ratio or relative risk?","a":"RR is easier to interpret but requires knowing the risks, so it is valid for cohort studies and trials; case-control studies can only estimate the OR. The OR approximates the RR when the outcome is rare (below about 10 %)."},{"q":"How do I read the confidence interval?","a":"If the OR (or RR) interval includes 1, the association is not statistically significant at the chosen level; the interval width shows the precision of the estimate."}],"tags":["odds ratio","relative risk","risk ratio","number needed to treat","2x2 table","confidence interval odds ratio"],"related":[{"calculator_id":"chi-square-test","reason":"Significance test for the same 2×2 table."},{"calculator_id":"diagnostic-test","reason":"Sensitivity, specificity and predictive values of a test."},{"calculator_id":"bayes-theorem","reason":"Update a probability with a likelihood ratio."}],"links":{"html":"https://tttkmbb.com/statistics/odds-ratio","markdown":"https://tttkmbb.com/statistics/odds-ratio.md","json":"https://tttkmbb.com/statistics/odds-ratio.json","api":"https://tttkmbb.com/api/v1/calculate/odds-ratio","schema":"https://tttkmbb.com/api/v1/calculators/odds-ratio","openapi":"https://tttkmbb.com/openapi.json","mcp":"https://tttkmbb.com/mcp"},"version":"v1","updated_at":"2026-09-24"},"timestamp":"2026-09-24T01:45:22Z"}