Statistics
Odds ratio & relative risk API
Computes the odds ratio and relative risk with log-based confidence intervals (Haldane-Anderson zero-cell correction) plus absolute risks and risk difference from a 2x2 exposure/outcome table. Answers 'What is the odds ratio and its 95% CI?', 'What is the relative risk between exposed and unexposed groups?'.
Price$0.08per request
MethodPOST
Route/v1/stats/odds-ratio-risk-ratio
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
statisticsodds-ratiorelative-riskepidemiology2x2confidence-intervalriskassociation
API URL
Integration docshttps://x402.hexl.dev/v1/stats/odds-ratio-risk-ratioExample request
{
"a": 20,
"b": 80,
"c": 10,
"d": 90
}Example response
{
"table": {
"exposedCases": 20,
"exposedNonCases": 80,
"unexposedCases": 10,
"unexposedNonCases": 90
},
"haldaneAndersonCorrection": false,
"confidence": 0.95,
"oddsRatio": 2.25,
"oddsRatioCI": [
0.994295,
5.091548
],
"relativeRisk": 2,
"relativeRiskCI": [
0.986563,
4.054479
],
"riskExposed": 0.2,
"riskUnexposed": 0.1,
"riskDifference": 0.1,
"rating": "CI includes 1 (no significant association)",
"interpretation": "OR=2.25 (95% CI 0.994–5.092); RR=2 (CI 0.987–4.054)."
}Input schema
{
"type": "object",
"required": [
"a",
"b",
"c",
"d"
],
"properties": {
"a": {
"type": "integer",
"examples": [
20
]
},
"b": {
"type": "integer",
"examples": [
80
]
},
"c": {
"type": "integer",
"examples": [
10
]
},
"d": {
"type": "integer",
"examples": [
90
]
},
"confidence": {
"type": "number",
"examples": [
0.95
]
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}