Odds Ratio & Risk Ratio Calculator
Enter counts or paste raw comma-separated data. Get the odds ratio, risk ratio, risk difference, NNT, 95% confidence intervals, a chi-square p-value and four publication-ready plots in one click.
Key takeaways
- Odds ratio (OR) = (a×d)/(b×c) compares odds; risk ratio (RR) = risk1/risk2 compares probabilities.
- Use RR for cohort studies and randomised trials; use OR for case-control studies and logistic regression.
- When the outcome is rare (<10%), OR ≈ RR. When it is common, OR overstates the effect.
- A 95% CI that includes 1 means the result is not statistically significant at α = 0.05.
- Report the point estimate, the CI, and the absolute risk difference with NNT — never the ratio alone.
1. Set Up Your Data
Binary data? Choose equal to 1 and paste 1s and 0s. Continuous data (e.g. blood pressure, mass, score)? Keep a cutoff to define the event.
Use + on any column to insert another one beside it, and × to remove it. The first two columns are the pair that gets compared — column 1 is the exposure and column 2 the reference.
Click the columns that should each become a cluster — selected columns will be loaded as separate clusters.
2. Results
2×2 contingency table
Expected counts under independence
Full results table
Association and effect-size measures
Visualisations
3. Interpretation of Results — In Detail
3.1 Reading the odds ratio
The odds ratio answers one question: how many times larger are the odds of the outcome in group 1 compared with group 2? Odds are not probabilities. If 45 of 100 exposed people have the outcome, the probability is 0.45 but the odds are 45/55 = 0.818. An OR of 2.45 therefore means the odds are about two and a half times higher in the exposed group, which is not the same as saying the outcome is two and a half times more likely.
- OR = 1 — no association. The odds are identical in both groups.
- OR > 1 — the exposure is associated with increased odds. OR = 1.5 is a 50% increase in odds; OR = 3.0 is a tripling.
- OR < 1 — the exposure is protective. OR = 0.60 means a 40% reduction in odds. To express a protective OR as an increase, invert it: 1/0.60 = 1.67, so the unexposed group has 67% higher odds.
Magnitude conventions used in epidemiology are rough but useful: OR between 1.0 and 1.5 is weak, 1.5 to 3.0 is moderate, 3.0 to 10 is strong, and above 10 is very strong. The same scale applies below 1 after inversion. These are heuristics, not thresholds — a small OR applied to a common disease can carry more public-health weight than a large OR on a rare one.
3.2 Reading the risk ratio
The risk ratio is the more intuitive measure because it compares actual probabilities. RR = 1.80 means the outcome occurred 80% more often in group 1 — a statement most readers, clinicians and reviewers understand without translation. The catch is that the risk ratio requires a valid denominator, meaning you must have sampled people and then followed them to see who developed the outcome. In a case-control study you sampled on the outcome itself, so the risks in the table are artefacts of your sampling fractions and the RR is meaningless. That is precisely why the OR exists.
Compare your two numbers. If OR and RR are close, the outcome is rare and either measure will do. If the OR is much further from 1 than the RR — for example OR = 2.45 versus RR = 1.80 — the outcome is common and quoting the OR as if it were a risk ratio would exaggerate your effect. This is one of the most frequent misreadings in the applied literature, and reviewers look for it.
3.3 Reading the confidence interval
The confidence interval is more informative than the point estimate. Three things to check, in order:
- Does it cross 1? If yes, the data are compatible with no effect at your chosen alpha level and the result is not statistically significant. If no, it is.
- How wide is it? An OR of 2.5 with CI [2.1, 3.0] and an OR of 2.5 with CI [1.05, 6.0] carry the same point estimate and completely different evidential weight. Width is driven mostly by the smallest cell in your table — the standard error contains 1/a + 1/b + 1/c + 1/d, so a single cell with 3 observations will dominate everything.
- Are both limits clinically meaningful? If the lower bound is 1.02, the data are compatible with a trivial effect even though p < 0.05. Statistical significance is not the same as importance.
Note that the interval is asymmetric around the point estimate on the ratio scale (e.g. 2.45 [1.34, 4.49] — the distance up is larger than the distance down). This is correct and expected, because the calculation is symmetric on the natural-log scale and then exponentiated back.
3.4 Reading the risk difference and NNT
Ratios hide the baseline. A risk ratio of 2.0 could mean 2% versus 1% or 60% versus 30% — identical ratios, wildly different consequences. The risk difference restores the baseline: RD = 0.20 means 20 extra events per 100 people. The number needed to treat is simply its reciprocal, 1/0.20 = 5, so five people must be exposed or treated for one additional event to occur. An NNT of 5 is a large effect; an NNT of 300 usually is not, however impressive the accompanying ratio looks.
When RD is positive (group 1 has more events) and the event is harmful, report NNH — number needed to harm — instead. This tool labels it automatically based on the sign of RD.
3.5 Reading the p-value
The p-value is the probability of observing an association at least this extreme if the true OR were exactly 1. It tells you nothing about effect size and nothing about the probability that your hypothesis is true. Report it alongside the CI, never instead of it. If any expected cell count is below 5 the chi-square approximation degrades and you should switch to Fisher's exact test; the tool flags this for you.
3.6 Decision guide — which measure should you report?
| Your design | Primary measure | Also report | Why |
|---|---|---|---|
| Randomised controlled trial | Risk ratio | RD + NNT | Risks are estimable and readers think in probabilities |
| Prospective cohort study | Risk ratio | RD, adjusted OR if modelling | Denominators are true populations at risk |
| Case-control study | Odds ratio | Exposure odds by group | Risks are not estimable under outcome-based sampling |
| Cross-sectional survey | Prevalence ratio (=RR) | Prevalence OR | RR is preferred unless prevalence is very low |
| Logistic regression output | Odds ratio | Predicted risks at set covariates | The model coefficient is a log odds ratio by construction |
| Meta-analysis input | Odds ratio | ln OR and SE(ln OR) | ORs pool symmetrically on the log scale |
| Outcome above ~20% common | Risk ratio | Never quote the OR as a risk | The OR diverges sharply from the RR |
3.7 Common mistakes this calculator prevents
- Zero cells. A zero in any cell makes the OR either 0 or infinite and the standard error undefined. The Haldane-Anscombe correction adds 0.5 to every cell. It is a defensible fix but it biases the estimate towards 1, so always disclose that you used it.
- Small cells. Any cell below 5 makes the Wald interval unreliable. Prefer exact or profile-likelihood intervals.
- Confounding. An unadjusted OR from a 2×2 table is crude. If a third variable is associated with both exposure and outcome, stratify (Mantel-Haenszel) or move to logistic regression.
- Reversed reference group. Swapping which group is group 1 inverts the ratio. Always state the reference group explicitly in your text.
- Dichotomising a continuous variable. If you set a cutoff to create the event, you lose information and power. Report the cutoff and justify it; do not go hunting for the cutoff that gives the smallest p-value.
4. How to Report Your Odds Ratio and Risk Ratio
4.1 Methods section
State the design, the measure, the software and the handling of edge cases in three or four sentences:
4.2 Results section — sentence templates
Significant, harmful exposure:
Significant, protective exposure:
Non-significant result — do not call it "no difference":
4.3 Table and figure conventions
- Report ratios to two decimal places and percentages to one.
- Always give the CI immediately after the point estimate, in the same units, with "95% CI" spelled out at first use.
- Give raw counts and denominators (45/100), not percentages alone — readers need to reconstruct your table.
- Use "to" rather than a dash inside intervals when either limit can be negative, to avoid ambiguity with the minus sign.
- Report exact p-values to two or three significant figures (p = 0.004, p = 0.31); use p < 0.001 only below that threshold.
- Name the reference group in the table header or footnote, e.g. "reference: unexposed".
- Plot ratios on a logarithmic x-axis in forest plots so that OR = 0.5 and OR = 2 are equidistant from the null line.
4.4 Discussion section
Address three things the reviewers will ask about: whether the OR was interpreted as a risk ratio (it should not have been if the outcome is common), whether confounding was addressed, and whether the precision of the estimate supports the strength of your claim. If your CI is wide, say so before the reviewer does.
5. Formulas Used
SE(ln RR) = √(1/a − 1/(a+b) + 1/c − 1/(c+d))
CI = exp[ ln(ratio) ± z × SE ]
SE(RD) = √[ R₁(1−R₁)/n₁ + R₂(1−R₂)/n₂ ]
RRR = (R₂ − R₁) / R₂ NNT = 1 / |RD|
χ²Yates = N(|ad − bc| − N/2)² / [(a+b)(c+d)(a+c)(b+d)]
6. How to Use This Calculator
- Pick your input mode. Use Raw data if you have measurements per participant; use 2×2 counts if you already have a table.
- Define the event. With raw data, set the rule and cutoff. For 0/1 data choose "equal to 1".
- Rename the groups. Group names are editable and feed straight into the tables and plots. The first group is the exposed/treatment group; the second is the reference.
- Paste or upload. Paste comma-separated values, or upload a CSV and click the columns you want — each selected column becomes its own cluster.
- Set the confidence level and the zero-cell policy.
- Calculate, then read the KPI cards, the 2×2 table, the full results table and the four plots.
- Download the .txt for your methods log so your numbers are reproducible.
7. Reference Tables
7.1 How far the odds ratio drifts from the risk ratio
Both groups below have a fixed risk ratio of 2.0. Only the baseline risk changes. This is the single most useful table in the tool: it shows exactly when quoting an OR as though it were a risk becomes indefensible.
| Risk in reference group | Risk in exposed group | Risk ratio | Odds ratio | OR / RR inflation | Verdict |
|---|---|---|---|---|---|
| 1% | 2% | 2.00 | 2.02 | 1.01× | OR ≈ RR — interchangeable |
| 2% | 4% | 2.00 | 2.04 | 1.02× | Safe |
| 5% | 10% | 2.00 | 2.11 | 1.06× | Safe |
| 10% | 20% | 2.00 | 2.25 | 1.13× | Borderline — state which you report |
| 20% | 40% | 2.00 | 2.67 | 1.33× | Report the RR |
| 30% | 60% | 2.00 | 3.50 | 1.75× | Report the RR |
| 40% | 80% | 2.00 | 6.00 | 3.00× | Quoting the OR as risk would badly mislead |
7.2 Interval width by cell size (balanced 2×2, RR fixed at 2.0)
Precision is driven by counts, not by the size of the effect. A doubling of risk can be statistically invisible at n = 25 per group and rock solid at n = 500.
| Per group | a / b | c / d | Odds ratio | 95% CI | Significant? |
|---|---|---|---|---|---|
| 25 | 10 / 15 | 5 / 20 | 2.67 | 0.75 to 9.44 | No |
| 50 | 20 / 30 | 10 / 40 | 2.67 | 1.09 to 6.51 | Yes, barely |
| 100 | 40 / 60 | 20 / 80 | 2.67 | 1.41 to 5.03 | Yes |
| 250 | 100 / 150 | 50 / 200 | 2.67 | 1.79 to 3.97 | Yes |
| 500 | 200 / 300 | 100 / 400 | 2.67 | 2.01 to 3.53 | Yes, precise |
| 1000 | 400 / 600 | 200 / 800 | 2.67 | 2.19 to 3.24 | Yes, very precise |
7.3 Reading an effect size at a glance
| Odds ratio | Equivalent protective OR | Change in odds | Conventional label |
|---|---|---|---|
| 1.00 | 1.00 | none | No association |
| 1.20 | 0.83 | +20% | Very weak |
| 1.50 | 0.67 | +50% | Weak |
| 2.00 | 0.50 | +100% | Moderate |
| 3.00 | 0.33 | +200% | Moderate to strong |
| 5.00 | 0.20 | +400% | Strong |
| 10.0 | 0.10 | +900% | Very strong |
7.4 Risk difference to NNT
| Risk difference | NNT / NNH | Practical reading |
|---|---|---|
| 50 percentage points | 2 | Every second person affected — very large |
| 20 points | 5 | Large, easily justifies action |
| 10 points | 10 | Substantial in most clinical settings |
| 5 points | 20 | Meaningful for common outcomes |
| 2 points | 50 | Modest; weigh against cost and harm |
| 1 point | 100 | Small; needs a cheap, safe intervention |
| 0.1 points | 1000 | Population-level relevance only |
7.5 Critical z values used for the confidence interval
| Confidence level | Alpha (two-sided) | z | Typical use |
|---|---|---|---|
| 90% | 0.10 | 1.6449 | Exploratory or pilot analyses |
| 95% | 0.05 | 1.9600 | Default for journal reporting |
| 99% | 0.01 | 2.5758 | Multiple comparisons or high-stakes claims |
8. Example Results
Eight fully worked cases covering the situations you are most likely to meet: common and rare outcomes, tiny samples, a zero cell, a null result, a precise small effect, a case-control design where the risk ratio must not be reported, and a field-ecology application. Each card shows the 2×2 table, every computed measure, a forest plot, what the numbers actually mean, and a sentence you can adapt for your manuscript.
Smoking and chronic cough
Common outcome — the odds ratio overstates the risk ratio
A prospective occupational cohort followed 100 smokers and 100 non-smokers for two years and recorded whether each person developed a chronic cough. Everyone was cough-free at enrolment, so both denominators are genuine populations at risk and the risk ratio is fully interpretable.
| Group | Event | No event | Total | Risk |
|---|---|---|---|---|
| Smokers | 45 (a) | 55 (b) | 100 | 45.0% |
| Non-smokers | 25 (c) | 75 (d) | 100 | 25.0% |
| Measure | Estimate | 95% CI |
|---|---|---|
| Odds ratio | 2.45 | 1.35 to 4.47 |
| Risk ratio | 1.80 | 1.20 to 2.69 |
| Risk difference | 20.0 pts | 7.1 to 32.9 pts |
| NNH | 5 | — |
| χ² (Yates, df = 1) | 7.93 | p = 0.005 |
This is the textbook case of a common outcome. Forty-five per cent of smokers coughed compared with twenty-five per cent of non-smokers. The odds ratio of 2.45 is a full 36% larger than the risk ratio of 1.80, and a reader who saw only the OR would conclude the risk had roughly two and a half times, when it actually rose 80%. Because this is a cohort design, the risk ratio is the number that belongs in the abstract.
Chronic cough developed in 45/100 smokers (45.0%) versus 25/100 non-smokers (25.0%). Smoking was associated with an increased risk of chronic cough (RR = 1.80, 95% CI 1.20 to 2.70; OR = 2.45, 95% CI 1.34 to 4.49; χ²1 = 7.93, p = 0.005). The absolute risk difference was 20.0 percentage points (95% CI 7.3 to 32.7), giving a number needed to harm of 5.
Vaccine against a rare infection
Rare outcome — odds ratio and risk ratio nearly identical
A double-blind randomised controlled trial allocated 500 participants to a vaccine and 500 to placebo, then counted laboratory-confirmed infections over one season. The outcome is uncommon in both arms.
| Group | Event | No event | Total | Risk |
|---|---|---|---|---|
| Vaccinated | 12 (a) | 488 (b) | 500 | 2.4% |
| Placebo | 40 (c) | 460 (d) | 500 | 8.0% |
| Measure | Estimate | 95% CI |
|---|---|---|
| Odds ratio | 0.28 | 0.15 to 0.55 |
| Risk ratio | 0.30 | 0.16 to 0.57 |
| Risk difference | -5.6 pts | -8.3 to -2.9 pts |
| NNT | 18 | — |
| χ² (Yates, df = 1) | 14.79 | p = < 0.001 |
With risks of 2.4% and 8.0%, the outcome is rare, and the odds ratio (0.28) and risk ratio (0.30) are almost identical. This is the regime in which the two measures are genuinely interchangeable, and it is why the OR became the default currency of case-control research and meta-analysis. Both point estimates sit well below 1 with intervals that exclude it, so the vaccine is clearly protective. Note the relative risk reduction of 70% sounds enormous while the absolute reduction is 5.6 percentage points — report both.
Infection occurred in 12/500 vaccinated participants (2.4%) and 40/500 placebo recipients (8.0%). Vaccination reduced infection risk by 70% (RR = 0.30, 95% CI 0.16 to 0.56; OR = 0.28, 95% CI 0.15 to 0.54; p < 0.001), an absolute risk reduction of 5.6 percentage points (95% CI 2.9 to 8.3) and a number needed to treat of 18.
A very rare adverse event
Huge point estimate, useless interval — underpowered
A safety database compared 1,000 patients on a new drug with 1,000 on an established comparator, looking for a rare serious adverse event. Only four events occurred in total.
| Group | Event | No event | Total | Risk |
|---|---|---|---|---|
| Drug | 3 (a) | 997 (b) | 1000 | 0.3% |
| Comparator | 1 (c) | 999 (d) | 1000 | 0.1% |
| Measure | Estimate | 95% CI |
|---|---|---|
| Odds ratio | 3.01 | 0.31 to 28.95 |
| Risk ratio | 3.00 | 0.31 to 28.79 |
| Risk difference | 0.2 pts | -0.2 to 0.6 pts |
| NNH | 500 | — |
| χ² (Yates, df = 1) | 0.25 | p = 0.617 |
The point estimate of 3.00 looks alarming, but the confidence interval runs from 0.31 to 28.8 — a range spanning a threefold protective effect to a near thirtyfold harm. With three and one events, the standard error is dominated by those tiny cells (1/3 + 1/1 alone contribute most of the variance). This result is uninformative, not reassuring and not alarming. Reporting it as a threefold increase in risk would be indefensible. The correct conclusion is that the study was far too small to characterise this event.
The adverse event occurred in 3/1000 (0.3%) drug-exposed and 1/1000 (0.1%) comparator patients. The estimated odds ratio was 3.01 (95% CI 0.31 to 28.9, Fisher's exact p = 0.62). The confidence interval is compatible with both substantial harm and substantial benefit; the study was underpowered to detect a difference of this magnitude and no conclusion about causal risk can be drawn.
No events in the treated arm
Haldane-Anscombe correction — and why it is conservative
A small trial randomised 50 patients per arm. No treated patient experienced the outcome; six controls did. The raw odds ratio is 0 and its standard error is undefined, so the calculator applies the Haldane-Anscombe correction of +0.5 to every cell.
| Group | Event | No event | Total | Risk |
|---|---|---|---|---|
| Treated | 0 (a) | 50 (b) | 50 | 0.0% |
| Control | 6 (c) | 44 (d) | 50 | 12.0% |
| Measure | Estimate | 95% CI |
|---|---|---|
| Odds ratio | 0.07 (+0.5 correction) | 0.00 to 1.24 |
| Risk ratio | 0.08 | 0.00 to 1.33 |
| Risk difference | -11.8 pts | -21.3 to -2.2 pts |
| NNT | 9 | — |
| χ² (Yates, df = 1) | 4.43 | p = 0.035 |
A zero cell breaks the arithmetic: dividing by b×c gives zero, and the log of zero is undefined. Adding 0.5 to all four cells restores a finite estimate, but that correction pulls the result towards the null, so the corrected OR is conservative — the true effect is at least as strong. The interval still brushes 1, so at 50 per arm this promising signal falls just short of conventional significance. Always disclose the correction in your methods; a reviewer who recomputes your table from the raw counts will otherwise get a different number.
No events were observed among 50 treated patients (0.0%) compared with 6/50 controls (12.0%). Because one cell contained zero observations, the Haldane-Anscombe correction (+0.5 to all cells) was applied, giving OR = 0.07 (95% CI 0.004 to 1.24) and RR = 0.08 (95% CI 0.005 to 1.30). The correction biases the estimate towards the null, so this represents a conservative bound; a larger trial is required for confirmation.
A negative finding
"No evidence of an association" is not "no association"
A cross-sectional survey of 200 participants found the outcome in 30 of 100 exposed and 28 of 100 unexposed individuals.
| Group | Event | No event | Total | Risk |
|---|---|---|---|---|
| Exposed | 30 (a) | 70 (b) | 100 | 30.0% |
| Unexposed | 28 (c) | 72 (d) | 100 | 28.0% |
| Measure | Estimate | 95% CI |
|---|---|---|
| Odds ratio | 1.10 | 0.60 to 2.03 |
| Risk ratio | 1.07 | 0.69 to 1.65 |
| Risk difference | 2.0 pts | -10.6 to 14.6 pts |
| NNH | 51 | — |
| χ² (Yates, df = 1) | 0.02 | p = 0.876 |
The odds ratio of 1.10 sits almost exactly on the null line and the interval comfortably contains 1. The right phrasing is "no evidence of an association", never "no association" and never "the groups were the same". Look at the interval width before you decide how strong your negative claim can be: here the upper limit of 2.02 means a doubling of odds has not been excluded, so this is a soft null, not a definitive one. Contrast with example 6, where a much tighter interval supports a genuinely confident statement.
The outcome was present in 30/100 exposed (30.0%) and 28/100 unexposed participants (28.0%). We found no evidence of an association (OR = 1.10, 95% CI 0.60 to 2.02; RR = 1.07, 95% CI 0.69 to 1.66; p = 0.88). The confidence interval remains compatible with effects ranging from a 40% reduction to a doubling of odds, so a clinically relevant association cannot be excluded.
A small but precise effect
Modest ratio, narrow interval — the mirror image of example 3
A pragmatic trial of 10,000 patients compared an intervention with standard care. Event rates were 10.4% and 12.0%.
| Group | Event | No event | Total | Risk |
|---|---|---|---|---|
| Intervention | 520 (a) | 4480 (b) | 5000 | 10.4% |
| Standard care | 600 (c) | 4400 (d) | 5000 | 12.0% |
| Measure | Estimate | 95% CI |
|---|---|---|
| Odds ratio | 0.85 | 0.75 to 0.96 |
| Risk ratio | 0.87 | 0.78 to 0.97 |
| Risk difference | -1.6 pts | -2.8 to -0.4 pts |
| NNT | 63 | — |
| χ² (Yates, df = 1) | 6.28 | p = 0.012 |
Here the ratio is modest (OR 0.85) but the interval is narrow enough to exclude the null decisively. This is the mirror image of example 3: a small effect measured precisely rather than a large effect measured badly. The absolute picture keeps it honest — a 1.6 percentage point reduction with an NNT of 63. Whether that is worth doing depends entirely on cost, harm and the seriousness of the outcome, which is a judgement your discussion section must make explicitly rather than leaving the reader to infer from a p-value.
The primary outcome occurred in 520/5000 intervention patients (10.4%) versus 600/5000 receiving standard care (12.0%). The intervention reduced the odds of the outcome by 15% (OR = 0.85, 95% CI 0.75 to 0.96; RR = 0.87, 95% CI 0.78 to 0.97; p = 0.011). The absolute risk reduction was 1.6 percentage points (95% CI 0.4 to 2.8), corresponding to a number needed to treat of 63.
Asbestos and lung cancer
Risk ratio is not estimable — report the odds ratio only
Investigators recruited 100 patients with lung cancer and 100 hospital controls, then asked each about historical asbestos exposure. Ninety per cent of cases and sixty per cent of controls reported exposure.
| Group | Event | No event | Total | Risk |
|---|---|---|---|---|
| Cases (lung cancer) | 90 (a) | 10 (b) | 100 | 90.0% |
| Controls | 60 (c) | 40 (d) | 100 | 60.0% |
| Measure | Estimate | 95% CI |
|---|---|---|
| Odds ratio | 6.00 | 2.79 to 12.91 |
| χ² (Yates, df = 1) | 22.43 | p = < 0.001 |
The 2×2 table can be filled in and the software will happily print a risk ratio of 1.50 — and that number is meaningless. The investigators chose how many cases and how many controls to recruit, so the apparent "risk" of cancer in this table is an artefact of the sampling ratio; recruiting 200 controls instead of 100 would change the RR while leaving the OR untouched. That invariance is precisely why the odds ratio exists. Report the OR of 6.00 and nothing else, and describe it as an association with exposure odds, not as a risk.
Asbestos exposure was reported by 90/100 cases (90.0%) and 60/100 controls (60.0%), giving an odds ratio of 6.00 (95% CI 2.83 to 12.73; χ²1 = 23.0, p < 0.001). Because participants were sampled on outcome status, risks and risk ratios are not estimable from this design and are therefore not reported.
Camera-trap detection at edge versus interior
Valid arithmetic, but clustering and detection bias come first
A camera-trap survey deployed 100 stations along a forest edge and 100 in the interior, each for 30 trap-nights, and recorded whether a focal carnivore was detected at least once per station.
| Group | Event | No event | Total | Risk |
|---|---|---|---|---|
| Edge stations | 34 (a) | 66 (b) | 100 | 34.0% |
| Interior stations | 18 (c) | 82 (d) | 100 | 18.0% |
| Measure | Estimate | 95% CI |
|---|---|---|
| Odds ratio | 2.35 | 1.22 to 4.53 |
| Risk ratio | 1.89 | 1.15 to 3.11 |
| Risk difference | 16.0 pts | 4.0 to 28.0 pts |
| NNH | 7 | — |
| χ² (Yates, df = 1) | 5.85 | p = 0.016 |
Detection is a binary station-level outcome, so a 2×2 table is legitimate and the risk ratio is interpretable because stations were chosen before any detection occurred. Edge stations detected the species roughly twice as often (34% versus 18%, RR = 1.89). Two ecological caveats matter more than the arithmetic: stations within the same habitat block are not fully independent, which will make this interval too narrow, and unequal detection probability between habitats can create the pattern without any real difference in occupancy. Treat this as a descriptive result and follow it with an occupancy model.
The focal species was detected at 34/100 edge stations (34.0%) and 18/100 interior stations (18.0%) over 30 trap-nights per station (OR = 2.35, 95% CI 1.23 to 4.48; RR = 1.89, 95% CI 1.14 to 3.13; χ²1 = 5.99, p = 0.014). Because stations within blocks may not be independent and detection probability may differ between habitats, these unadjusted estimates were followed by a single-season occupancy model incorporating detection covariates.
9. When to Use This Calculator
Use it when
- You have a binary outcome and two independent groups, and you want the crude association between them.
- You are writing up a cohort study, a randomised trial, a case-control study or a cross-sectional survey and need OR, RR, RD and NNT together with intervals.
- You have continuous measurements and a pre-specified clinical or ecological cutoff that defines an event.
- You need to sanity-check an odds ratio reported in a paper against its own published 2×2 table.
- You are teaching or learning the difference between odds and risk and want to see both computed side by side on the same data.
- You want a quick forest plot of a single comparison for a slide or a supplementary figure.
Do not use it when
- Your data are paired or matched — before/after measurements on the same individuals, matched case-control pairs, or split-plot designs. Use McNemar's test or conditional logistic regression.
- You need to adjust for confounders — a crude 2×2 ratio can reverse sign once age, sex or site is controlled for. Use Mantel-Haenszel stratification or logistic regression.
- Your outcome is a rate over person-time — incidence rate ratios require follow-up time in the denominator, not counts of people.
- Your outcome is continuous — dichotomising to force it into a 2×2 table throws away power. Use a t-test, Mann-Whitney or regression instead.
- You have more than two exposure levels and want a trend — use the Cochran-Armitage test for trend or logistic regression with an ordinal term.
- Your observations are clustered — repeated visits, households, litters, camera stations. Independence is violated and intervals will be too narrow.
- You are planning a study rather than analysing one — you need a power and sample size calculator, not an effect size calculator.
10. Assumptions and Limitations
- Observations are independent; each participant appears in exactly one cell.
- Both the exposure and the outcome are binary (or have been dichotomised by your cutoff).
- The Wald confidence interval assumes an approximately normal sampling distribution of the log ratio, which fails with small or zero cells.
- The risk ratio requires cohort-style sampling; it is not interpretable in a case-control design.
- No adjustment for confounders is performed. Use Mantel-Haenszel stratification or logistic regression when confounding is plausible.
- Matched or paired designs need conditional methods (McNemar's test, conditional logistic regression), not this unmatched 2×2 approach.
- Clustered data (repeated measures, sites, litters) violate independence and need GEE or mixed models.
11. Conclusion
The odds ratio and the risk ratio answer closely related but genuinely different questions, and choosing between them is a design decision rather than a stylistic one. If your participants were recruited before the outcome occurred — a cohort study, a randomised trial, a prospective field survey — then risks are estimable and the risk ratio is the measure your readers will understand fastest. If your participants were recruited because of their outcome status, as in a case-control study, then risks are not estimable at all and the odds ratio is the only valid ratio measure available. The same arithmetic applies in both cases, but the interpretation does not transfer.
The second decision is how much of the picture to report. A ratio on its own is an incomplete result because it is silent about the baseline. Two studies can both report a risk ratio of 2.0 while one describes twenty extra cases per hundred people and the other describes one extra case per ten thousand. Pairing every ratio with the absolute risk difference and its reciprocal, the number needed to treat, closes that gap and is now expected by most journals in health and applied ecology alike. This calculator returns all four measures together for exactly that reason.
Precision deserves as much attention as the estimate itself. Because the standard error of the log ratio sums the reciprocals of all four cells, one sparse cell can widen a confidence interval enough to make an apparently large effect uninformative. Before you write a strong sentence in your abstract, look at the width of the interval and at the smallest count in your table. If a cell is under five, treat the Wald interval as provisional and move to an exact method. If a cell is zero, apply the Haldane-Anscombe correction, state that you did, and be candid that the corrected estimate is conservative.
Finally, remember what a 2×2 table cannot do. It cannot separate association from causation, it cannot adjust for a confounder, and it cannot rescue a design that sampled the wrong people. It is the right first step and a poor last one. Use these numbers to describe the association cleanly and honestly, then move to stratified or regression-based methods when the research question demands adjustment. Reported this way — estimate, interval, absolute difference, and an explicit statement of the reference group and the design — your result will be reproducible, reviewable, and directly comparable with the rest of your field's literature.
12. Frequently Asked Questions
What is the difference between an odds ratio and a risk ratio?
A risk ratio compares probabilities; an odds ratio compares odds (probability divided by its complement). They agree when the outcome is rare and diverge as it becomes common, with the OR always further from 1.
When should I use an odds ratio instead of a risk ratio?
Use the OR for case-control studies, for any analysis based on logistic regression, and for meta-analysis where ORs are the pooled currency. Use the RR for cohort studies and randomised trials.
What does an odds ratio of 2 mean?
The odds of the outcome are twice as high in group 1 as in group 2. It does not mean the outcome is twice as likely unless the outcome is rare.
What does an odds ratio of 0.5 mean?
The odds are halved — a 50% reduction. Equivalently, the reference group has twice the odds (1/0.5 = 2).
How do I know if my odds ratio is statistically significant?
Check whether the 95% confidence interval includes 1. If it does not, the result is significant at p < 0.05.
Why is my confidence interval asymmetric?
Because it is computed symmetrically on the natural-log scale and then exponentiated. That is the correct procedure, not an error.
What do I do if one cell is zero?
Add 0.5 to all four cells (Haldane-Anscombe). This tool does it automatically when you leave zero-cell handling on "Auto". Disclose the correction in your methods.
Can I calculate a risk ratio from a case-control study?
No. Case-control sampling fixes the number of cases and controls, so the apparent risks are artefacts of your sampling fractions.
What sample size do I need?
There is no universal answer, but every cell should ideally exceed 10 for a stable Wald interval. Run a formal power calculation based on your expected baseline risk and target effect.
Should I use the chi-square test or Fisher's exact test?
Use chi-square when all expected counts are at least 5; otherwise use Fisher's exact test. The tool flags small expected counts for you.
What is the difference between NNT and NNH?
They are the same arithmetic (1/|RD|) labelled by direction: NNT when the intervention reduces a harmful outcome, NNH when it increases one.
Why does my odds ratio look bigger than my risk ratio?
Your outcome is common. The OR inflates relative to the RR as baseline risk rises — a known and expected property, not a mistake.
Can I use this for more than two groups?
Add extra clusters and compare them pairwise against your chosen reference. For a single omnibus model, use logistic regression.
Does this tool adjust for confounders?
No. It gives the crude, unadjusted association. For adjustment, use Mantel-Haenszel stratification or logistic regression.
Which cutoff should I use for continuous data?
One defined a priori from the literature or clinical guidance. Never choose the cutoff that minimises your p-value — that inflates the false-positive rate substantially.
Is the risk difference confidence interval on the same scale?
Yes — it is a Wald interval on the difference of proportions and can legitimately include negative values.
Can I report an odds ratio as a percentage change?
Yes: (OR − 1) × 100 gives the percentage change in odds. Be explicit that it refers to odds, not risk.
How many decimal places should I report?
Two for ratios and their limits, one for percentages, and two to three significant figures for p-values.
Does this work on a phone?
Yes. The layout, tables and all four plots reflow to a single column below 860 px.
Is my data uploaded anywhere?
No. Every calculation and every plot runs entirely in your browser; nothing is transmitted.
13. Cite This Tool
Free to use and free to reference. If this calculator helped with an analysis, a citation or a link is appreciated.
StatsUnlock. (2026). Odds Ratio & Risk Ratio Calculator [Interactive statistical tool]. https://statsunlock.com/odds-ratio-risk-ratio-calculator/
@misc{statsunlock_orrr_2026,
title = {Odds Ratio and Risk Ratio Calculator},
author = {{StatsUnlock}},
year = {2026},
note = {Interactive statistical tool},
url = {https://statsunlock.com/odds-ratio-risk-ratio-calculator/}
}
Odds ratios and risk ratios with 95% confidence intervals were calculated using the StatsUnlock Odds Ratio and Risk Ratio Calculator (statsunlock.com), applying Woolf's log method for interval estimation and the Haldane-Anscombe correction where a contingency cell contained zero observations.
14. Related Tools
Part of the StatsUnlock experimental design and power toolkit — all free, no signup, and they work together.
Work out the visitors per variant you need before launching, from your baseline rate, minimum detectable effect, confidence and power.
Open the tool →Effect size, achieved power, required sample size per group and the minimum detectable effect for t-tests and one-way ANOVA.
Open the tool →See alpha, beta and power as areas under two curves, and how often a significant result is actually a false positive.
Open the tool →Test independence in any r × c contingency table with expected counts, residuals and effect size measures.
Open the tool →15. References
- Bland JM, Altman DG. (2000). The odds ratio. BMJ, 320(7247), 1468. doi:10.1136/bmj.320.7247.1468
- Altman DG, Bland JM. (2011). How to obtain the confidence interval from a P value. BMJ, 343, d2090. doi:10.1136/bmj.d2090
- Woolf B. (1955). On estimating the relation between blood group and disease. Annals of Human Genetics, 19(4), 251–253. doi:10.1111/j.1469-1809.1955.tb01348.x
- Haldane JBS. (1956). The estimation and significance of the logarithm of a ratio of frequencies. Annals of Human Genetics, 20(4), 309–311. doi:10.1111/j.1469-1809.1955.tb01285.x
- Anscombe FJ. (1956). On estimating binomial response relations. Biometrika, 43(3–4), 461–464. doi:10.1093/biomet/43.3-4.461
- Zhang J, Yu KF. (1998). What's the relative risk? JAMA, 280(19), 1690–1691. doi:10.1001/jama.280.19.1690
- Greenland S. (1987). Interpretation and choice of effect measures in epidemiologic analyses. American Journal of Epidemiology, 125(5), 761–768. doi:10.1093/oxfordjournals.aje.a114593
- Cook RJ, Sackett DL. (1995). The number needed to treat. BMJ, 310(6977), 452–454. doi:10.1136/bmj.310.6977.452
- Altman DG. (1998). Confidence intervals for the number needed to treat. BMJ, 317(7168), 1309–1312. doi:10.1136/bmj.317.7168.1309
- Newcombe RG. (1998). Interval estimation for the difference between independent proportions. Statistics in Medicine, 17(8), 873–890. doi:10.1002/(SICI)1097-0258
- Agresti A. (2013). Categorical Data Analysis, 3rd ed. Wiley. doi:10.1002/0471249688
- Rothman KJ, Greenland S, Lash TL. (2008). Modern Epidemiology, 3rd ed. Lippincott. Publisher page
- Mantel N, Haenszel W. (1959). Statistical aspects of the analysis of data from retrospective studies. JNCI, 22(4), 719–748. doi:10.1093/jnci/22.4.719
- Cornfield J. (1951). A method of estimating comparative rates from clinical data. JNCI, 11(6), 1269–1275. doi:10.1093/jnci/11.6.1269
- Yates F. (1934). Contingency tables involving small numbers and the chi-square test. JRSS Supplement, 1(2), 217–235. doi:10.2307/2983604
- Fisher RA. (1922). On the interpretation of chi-square from contingency tables. JRSS, 85(1), 87–94. doi:10.2307/2340521
- Davies HTO, Crombie IK, Tavakoli M. (1998). When can odds ratios mislead? BMJ, 316(7136), 989–991. doi:10.1136/bmj.316.7136.989
- Schulz KF, Altman DG, Moher D. (2010). CONSORT 2010 Statement. BMJ, 340, c332. doi:10.1136/bmj.c332
- von Elm E, et al. (2007). The STROBE Statement. PLoS Medicine, 4(10), e296. doi:10.1371/journal.pmed.0040296
- Wasserstein RL, Lazar NA. (2016). The ASA statement on p-values. The American Statistician, 70(2), 129–133. doi:10.1080/00031305.2016.1154108
























