Relative Risk Calculator - Risk Ratio, 2x2 Table, 95% CI
Use this relative risk calculator to compute the risk ratio from a 2x2 cohort table. Get RR, the Katz log 95% confidence interval, a z-test p-value, and a plain-English protective or risk-factor label.
Relative Risk Calculator
Results
What Is Relative Risk Calculator?
A relative risk calculator is a 2x2 table tool that compares the probability of an outcome in an exposed group to the probability of the same outcome in an unexposed control group and returns the risk ratio (RR), the Katz log 95% confidence interval, a Wald z-test p-value, and a plain-English protective or risk-factor label. Enter the four cell counts from a cohort study or randomized trial and the calculator shows whether the exposure is protective, neutral, or a risk factor.
- • Cohort study summary: Epidemiologists and biostatisticians can summarize a cohort study with a single risk ratio and 95% confidence interval.
- • Randomized trial readouts: Clinical trialists can compute the relative risk of an adverse event in the treatment arm versus the control arm.
- • AP statistics and biostatistics homework: Students can confirm the relative risk from a textbook 2x2 table in one pass.
Relative risk is the most intuitive way to read a 2x2 cohort table because it is a direct ratio of two incidences.
In a case-control study the relative risk cannot be estimated directly, and the odds ratio is the correct measure; the comparison is in the key concepts.
When the cohort is split into a treatment arm and a control arm with conversion-style outcomes, the same 2x2 cell counts feed into an AB Test Calculator that returns the z-score and a per-variant sample size.
How Relative Risk Calculator Works
The relative risk calculator divides the incidence in the exposed group (a / (a + b)) by the incidence in the unexposed group (c / (c + d)) and then runs a Katz log inference step on the resulting risk ratio. The same form also returns a Wald z-statistic and a two-tailed p-value.
- a, b: Exposed-arm cell counts: a is the number of exposed subjects with the outcome, b is the number without the outcome.
- c, d: Unexposed-arm cell counts: c is the number of control subjects with the outcome, d is the number without the outcome.
- confidenceLevel: Confidence level for the interval. Conventional values are 0.90, 0.95, and 0.99.
- applyZeroCorrection: When on, adds 0.5 to all four 2x2 cells (Haldane-Anscombe correction) so the formula stays defined when a, b, c, or d is zero.
The Katz log method is the conventional confidence interval for a 2x2 table risk ratio because the log of the relative risk is approximately normal for moderate-to-large samples.
When any cell is zero, the calculator optionally adds 0.5 to all four cells (Haldane-Anscombe correction) so the formula stays finite.
Omni worked example: 8 of 100 heavy drinkers vs 1 of 100 controls (liver failure)
a = 8, b = 92, c = 1, d = 99, confidenceLevel = 0.95, applyZeroCorrection = off
p1 = 0.08, p2 = 0.01, RR = 8. SE = sqrt(1/8 + 1/1 - 1/100 - 1/100) = 1.0512. The 95% CI on the log scale is 2.0794 plus or minus 1.96 times 1.0512, which exponentiates to 1.02 and 62.79.
RR = 8, 95% CI 1.02 to 62.79, z = 1.978, p = 0.0479, label = 'Risk factor (RR = 8)'.
Heavy drinkers are 8 times more likely to experience liver failure than the control group. The interval is wide because the unexposed arm has only one event.
According to MedCalc Relative Risk Calculator, MedCalc documents the Katz log method (Altman 1991) for a 2x2 table relative risk: RR = [a / (a + b)] / [c / (c + d)], with standard error from the four cell counts and a 95% confidence interval of exp(ln(RR) plus or minus 1.96 times SE).
If the next decision is a Wald or t confidence interval on a single proportion rather than the ratio of two, the Confidence Interval Calculator runs the same workflow on one cell at a time.
Key Concepts Explained
Four ideas carry the meaning behind the result, and they are the same ideas that show up in any 2x2 contingency-table analysis in an epidemiology class.
2x2 cohort table layout
The four cells a, b, c, d summarize how many exposed and unexposed subjects did and did not experience the outcome. The relative risk compares the two row incidences.
Katz log confidence interval
The natural log of the relative risk is approximately normal, so the standard error of ln(RR) is computed directly from the cell counts and the bounds are exp(ln(RR) plus or minus 1.96 times SE).
Risk factor vs protective factor
An RR above 1 means the exposure raises the incidence (a risk factor), an RR of 1 means the exposure has no effect, and an RR below 1 means the exposure lowers the incidence (a protective factor such as a vaccine).
Relative risk vs odds ratio
The relative risk and the odds ratio are equal only when the outcome is rare in both groups. In cohort studies the relative risk is the natural measure; in case-control studies the odds ratio is the only measure that can be estimated.
The Wald z-statistic on the log relative risk is the conventional test statistic, and the corresponding 95% confidence interval uses the same standard error, so a result is statistically significant exactly when the 95% CI excludes 1.
The Wald z-statistic on ln(RR) follows the standard normal distribution under the null hypothesis of no effect, and the Z-Score Calculator walks through the formula with a single-proportion example.
How to Use This Calculator
Five short steps turn a 2x2 cohort table into a relative risk, a confidence interval, and a p-value.
- 1 Fill in the exposed row of the 2x2 table: Enter a (exposed with outcome) and b (exposed without outcome). The default 8 and 92 reproduces the 8-of-100 example.
- 2 Fill in the unexposed row of the 2x2 table: Enter c (control with outcome) and d (control without outcome). The default 1 and 99 reproduces the same example.
- 3 Pick the confidence level: Choose 90%, 95%, or 99% from the selector. The default 95% matches the conventional threshold for a 'significant' result.
- 4 Decide on the zero-cell correction: Turn the Haldane-Anscombe correction on when any cell is zero or the table is very sparse.
- 5 Read the results panel: The panel shows the incidence in each group, the relative risk, the Katz log confidence bounds, the Wald z-score, the two-tailed p-value, and a protective or risk-factor label.
If your cohort recorded 8 liver-failure cases out of 100 heavy drinkers and 1 case out of 100 controls, the calculator returns RR = 8, 95% CI 1.02 to 62.79, z = 1.978, p = 0.0479, and a 'Risk factor' label, so the heavy-drinking exposure is associated with an 8x higher incidence and the result is significant at the 5% level.
When the same 2x2 table is reported with a chi-square test of independence instead of a relative risk, the Chi-Square Calculator returns the chi-square statistic and the p-value for the same four cells.
Benefits of Using This Calculator
A purpose-built 2x2 calculator removes the spreadsheet shuffling and gives students one place to read a relative risk, a confidence interval, and a p-value together.
- • Direct 2x2 table input: Enter the four cell counts a, b, c, d the same way they appear in a cohort study, and the calculator returns the relative risk and confidence interval.
- • Katz log 95% confidence interval: The same form returns the Katz log 95% confidence interval for the relative risk, the conventional interval in epidemiology papers.
- • Wald z-test and p-value: A Wald z-statistic and a two-tailed p-value let you decide whether the relative risk differs from 1, and the result lines up with the confidence interval.
- • Zero-cell handling built in: When a cell is zero, the Haldane-Anscombe 0.5 correction keeps the formula finite and the result comparable to software such as MedCalc.
The same form is useful for journal clubs and teaching demos: a 2x2 table from a paper can be re-entered in seconds and the published risk ratio confirmed against the Katz log interval.
For a continuous outcome such as blood pressure change, the same cohort can be summarized with a t-test, and the T-Test Calculator handles the two-sample t-statistic and confidence interval.
Factors That Affect Your Results
Three variables determine the result and the confidence interval width, and three limitations tell you when to extend the analysis beyond a single 2x2 table.
Sample size and event counts
Small cohorts produce wide confidence intervals because the standard error of ln(RR) depends on 1 / a and 1 / c. Doubling the cohort size roughly halves the standard error of the log risk ratio.
Choice of confidence level
Selecting 90% instead of 95% shrinks the interval, and 99% widens it. The calculator uses the standard normal critical value at the chosen level so the bound math stays consistent with the Wald z-test.
Zero-cell correction and sparse tables
Turning the Haldane-Anscombe correction on adds 0.5 to all four cells, which keeps the formula finite when a, b, c, or d is zero.
- • The relative risk is only defined for cohort studies and randomized trials; in a case-control study the odds ratio is the correct measure because the sampling fractions of cases and controls are set by design.
- • The Wald z-test on ln(RR) and the Katz log interval are both large-sample approximations. With fewer than about 20 events in either arm, exact methods such as Fisher's exact test are more reliable.
- • The relative risk captures association, not causation. A large RR can still be explained by confounding, reverse causation, or selection bias, so the result should be read together with the study design and any adjusted analyses.
The same z-statistic that drives the 95% confidence interval also drives the p-value, so the conclusion of a hypothesis test and a confidence-interval read always agree when alpha is 1 minus the confidence level.
According to Wikipedia, Relative risk, Wikipedia documents that the relative risk is the ratio of the probability of an outcome in an exposed group to the probability of the same outcome in an unexposed group, that the odds ratio asymptotically approaches the relative risk under the rare-disease assumption, and that the standard error of ln(RR) is sqrt( IN/(IE(IE+IN)) + CN/(CE*(CE+CN)) ).
According to Omni Calculator Relative Risk page, The Omni Relative Risk calculator applies the same Katz log method and reports the 95% confidence interval of 1.02 to 62.7 for the 8-of-100 versus 1-of-100 liver-failure example, the same interval this calculator reproduces.
Frequently Asked Questions
Q: What is a relative risk calculator?
A: A relative risk calculator is a 2x2 table tool that computes the risk ratio (RR), the Katz log confidence interval, a Wald z-test p-value, and a plain-English protective or risk-factor label from the four cell counts of a cohort study or randomized trial. It returns the incidence in each group, the relative risk point estimate, the lower and upper confidence bounds, the z-score, and the p-value in a single read.
Q: How do you calculate relative risk from a 2x2 table?
A: Compute the incidence in the exposed group as a / (a + b) and the incidence in the unexposed group as c / (c + d). The relative risk is the ratio of the two incidences, RR = [a / (a + b)] / [c / (c + d)]. For the 8-of-100 heavy drinkers versus 1-of-100 controls example, the incidences are 0.08 and 0.01 and the relative risk is 8.
Q: What is a good relative risk?
A: There is no universal 'good' value, because a useful risk ratio depends on the clinical or policy context. As a rule of thumb, RR = 1 means no effect, RR < 1 means the exposure is protective, and RR > 1 means the exposure is a risk factor. The 95% confidence interval tells you whether the observed effect is statistically distinguishable from no effect at the conventional alpha = 0.05 level.
Q: What is the difference between relative risk and odds ratio?
A: The relative risk compares the two incidences directly and is the natural measure in cohort studies and randomized trials. The odds ratio compares the two odds and is the only measure that can be estimated in case-control studies. The two measures are equal when the outcome is rare in both groups, and they diverge as the incidence rises above about 10%.
Q: How is the relative risk confidence interval calculated?
A: The Katz log method takes the natural log of the relative risk and computes its standard error from the four cell counts. The 95% confidence interval is then exp( ln(RR) +/- 1.96 * SE ), and the bounds are exponentiated back to the original risk ratio scale. The same SE is used for the Wald z-test and the corresponding p-value.
Q: What does a relative risk of 1 mean?
A: A relative risk of 1 means the incidence in the exposed group equals the incidence in the unexposed group, so the exposure has no effect on the probability of the outcome. A 95% confidence interval that includes 1 is consistent with no effect, and an interval that sits entirely on one side of 1 means the effect is statistically significant at the 5% level.