Relative risk and NNT: aspirin and heart attack
A randomized trial comparing heart attacks in aspirin and placebo groups.
Enter a 2×2 table to get the odds ratio, relative risk and NNT with confidence intervals and exact tests.
95% CI 0.47 to 0.71 · RR 0.58 · NNTB 111 · Chi-square p < 0.0001
| Measure | Estimate | Confidence interval | Method |
|---|---|---|---|
| Odds ratio | 0.58 | 0.47 to 0.71 | Woolf |
| Conditional exact OR | 0.58 | 0.46 to 0.71 | Exact (conditional) |
| Relative risk | 0.58 | 0.47 to 0.72 | Katz |
| Relative risk reduction | 41.9% | 28.5% to 52.7% | Katz |
| Risk difference | −0.91 percentage points | −1.25 to −0.57 | Newcombe |
| Number needed to treat | NNTB 111 | NNTB 80 to 177 | 1 / |RD| |
| Event risk: Aspirin | 1.3% | 1.1% to 1.5% | Wilson |
| Event risk: Placebo | 2.2% | 1.9% to 2.5% | Wilson |
Minimum expected count: 188.97
| Test | Statistic | Degrees of freedom | p value |
|---|---|---|---|
| Fisher: two-sided | — | — | p < 0.0001 |
| Chi-square | 26.9 | 1 | p < 0.0001 |
| Chi-square (Yates) | 26.4 | 1 | p < 0.0001 |
| Name | Heart attack | No heart attack | Total |
|---|---|---|---|
| Aspirin | 139 / 189.03 | 10,898 / 10,847.97 | 11,037 |
| Placebo | 239 / 188.97 | 10,795 / 10,845.03 | 11,034 |
| Total | 378 | 21,693 | 22,071 |
Heart attack occurred in Aspirin (139 of 11,037, 1.3%) and in Placebo (239 of 11,034, 2.2%). OR 0.58 (95% CI 0.47 to 0.71); RR 0.58 (95% CI 0.47 to 0.72); Chi-square p < .0001. Risk difference −0.91 percentage points, 95% CI −1.25 to −0.57; NNTB 111 (NNTB 80 to 177).
Odds ratios with 95% confidence intervals were calculated using the Woolf method. Relative risks used Katz intervals and risk differences used Newcombe intervals. Groups were compared using the chi-square test.
Explore real studies and common 2×2 analyses.
A randomized trial comparing heart attacks in aspirin and placebo groups.
Compare smoking exposure in men with and without lung cancer.
A common outcome shows why OR and RR can differ.
No severe cases occurred in the vaccine group.
A small table illustrates Fisher’s exact test.
Uses the corrected count of 20 heart attacks in the rofecoxib group.
Compare crude and adjusted odds ratios across three strata.
Compare crude and department-adjusted odds ratios.
Enter your counts, choose a method and export the results.
Select cohort or trial, or case–control.
Fill the 2×2 table or enter events and totals.
Compare the estimates, intervals and tests.
Download a figure or copy a report.
Choose an estimate that fits the way the data were collected.
| Design | Measures | Default interval | Notes |
|---|---|---|---|
| Case–control | OR only | Woolf | Sampling fixes case and control totals. |
| Cohort or trial | OR, RR, RD, NNT | Woolf, Katz, Newcombe | Risk estimates require defined groups and follow-up. |
| Cross-sectional | OR, RR | Woolf, Katz | RR is a prevalence ratio. |
When an outcome is common, an odds ratio can lie farther from 1 than the risk ratio. In the birth-weight example, OR is 2.02 and RR is 1.61.
Auto selects Fisher when any expected count is below 5, and Pearson chi-square otherwise. The selected test is named with the result.
Adding 0.5 to all four cells supports Woolf and Katz intervals. Fisher and conditional exact intervals use the original counts.
Use strata to compare a crude odds ratio with a Mantel–Haenszel estimate. The Breslow–Day test examines variation among strata.
References: Zhang & Yu (1998) · Cochran (1954) · Haldane (1956) · Mantel & Haenszel (1959) · Breslow & Day (1980)
For a table with cells a, b, c and d, the estimators are:
OR = (a × d) / (b × c)
OR = 139 × 10,795 / (10,898 × 239) = 0.58
SE(log OR) = √(1/a + 1/b + 1/c + 1/d)
RR = [a / (a + b)] / [c / (c + d)]
SE(log RR) = √[1/a − 1/(a + b) + 1/c − 1/(c + d)]
RD = a / (a + b) − c / (c + d)
NNT = 1 / |RD|
Newcombe combines Wilson intervals for the two risks; NNT is the reciprocal of the absolute risk difference.
χ² = Σ (O − E)² / E
P(a) = C(a + b, a) C(c + d, c) / C(n, a + c)
ORMH = Σ(aᵢdᵢ/nᵢ) / Σ(bᵢcᵢ/nᵢ)
References: Woolf (1955) · Katz et al. (1978) · Newcombe (1998) · Altman (1998) · Fisher (1935) · Robins, Breslow & Greenland (1986)
Multiply a by d and divide by b times c. A Woolf confidence interval uses the logarithm of the odds ratio.
Relative risk compares probabilities; an odds ratio compares odds. For common outcomes, the odds ratio is often farther from 1.
An OR above 1 indicates higher odds in the first group; an OR below 1 indicates lower odds. A wide interval indicates substantial uncertainty. To convert an odds ratio to Cohen’s d, use the effect size calculator.
Fisher’s test is useful for small expected counts. Auto selects it when any expected count is below 5.
A 0.5 correction can support Woolf and Katz intervals; exact methods use the original counts. If neither group has events, OR and RR are not estimable.
NNT is the reciprocal of the absolute risk difference, rounded up. A confidence interval crossing zero extends through infinity between benefit and harm.
Yes. Enter strata to calculate a Mantel–Haenszel odds ratio; multiple covariates require a regression model.
Diagnostic tables use sensitivity and specificity; pooling studies uses a forest plot; survival times use a Kaplan–Meier analysis. Paired data need McNemar’s test, tables larger than 2×2 need r×c methods, and prospective sample size needs power analysis. Related tools: sensitivity and specificity calculator · forest plot generator · Kaplan–Meier curve generator · power analysis calculator.
Methods and defaults differ across statistical packages. The conditional exact interval inverts Fisher’s noncentral hypergeometric distribution using high-precision root solving; R fisher.test uses a default solver tolerance, so results can differ in later significant digits. Counts stay in your browser. Woolf uses a large-sample approximation; exact intervals are useful with small or zero cells, while mid-p intervals are less conservative.
Calculate effect measures, confidence intervals and tests in your browser.
Calculate an odds ratio