How to Use the Relative Risk Calculator
This calculator allows you to calculate the relative risk (RR), also known as the risk ratio, and test whether the risk of an outcome differs significantly between two groups using a 2 × 2 contingency table.
To use the calculator:
- Enter the observed frequencies in the four cells (a, b, c, and d) of the contingency table.
- Enter the significance level, α, usually 0.05.
- Set the confidence level, such as 90%, 95%, or 99%, and select the number of decimal places.
- Click Calculate.
The calculator returns the relative risk, confidence interval, risk in each group, Chi-Square statistic, degrees of freedom, p-value, and hypothesis-testing decision. It also provides a step-by-step solution showing how to calculate relative risk and test whether the association is statistically significant.
What Is Relative Risk?
Relative risk (RR) is a statistical measure used to compare the probability of an outcome occurring in one group with the probability of the same outcome occurring in another group.
For example, a researcher may want to determine whether workers exposed to industrial dust are more likely to develop respiratory problems than those who are not exposed. In this case, relative risk compares the probability of developing respiratory problems among exposed workers with the probability among unexposed workers.
Relative risk is commonly used in cohort studies, randomized controlled trials, and epidemiological research where the risk of an outcome can be estimated for each group.
Relative Risk Formula
The relative risk formula is derived from the following 2 × 2 contingency table of observed frequencies.
| Group | Outcome (Yes) | Outcome (No) | Total |
|---|---|---|---|
| Exposed | a | b | a + b |
| Unexposed | c | d | c + d |
In the above table.
- a is the number of exposed individuals with the outcome.
- b is the number of exposed individuals without the outcome.
- c is the number of unexposed individuals with the outcome.
- d is the number of unexposed individuals without the outcome.
Using the contingency table, we can calculate the risk of the outcome in each group as follows:
- Risk in the exposed group, Risk₁ = a / (a + b)
- Risk in the unexposed group, Risk₂ = c / (c + d)
By definition, relative risk is obtained by dividing the risk in the exposed group by the risk in the unexposed group. In other words, RR = Risk₁ / Risk₂
Therefore, the relative risk formula is:
Confidence Interval Formula
The relative risk confidence interval provides a range of plausible values for the population relative risk. Its general formula is:

Where:
- RR is the calculated relative risk.
- ln(RR) is the natural logarithm of the relative risk.
- Z₁₋α/₂ is the z critical value corresponding to the selected confidence level.
- α is the significance level.
- exp stands for exponentiation.
Tip. This formula gives an approximate confidence interval using the log-risk-ratio method. It is most appropriate when the sample size and cell frequencies are sufficiently large.
How to Interpret Relative Risk
Struggling to interpret relative risk? The table below provides a quick summary of its interpretation.
| Relative Risk | Interpretation |
|---|---|
| RR = 1 | The risk of the outcome is equal in both groups. |
| RR > 1 | The exposed group has a higher risk of the outcome. |
| RR < 1 | The exposed group has a lower risk of the outcome. |
For example, an RR of 1.5 indicates that the exposed group has 1.5 times the risk of the outcome, representing a 50% higher risk compared with the unexposed group. However, an RR of 0.75 suggests that the exposed group has a 25% lower risk of the outcome.
Notice. A relative risk greater than 1 does not necessarily indicate a harmful exposure. The interpretation depends on the outcome being studied. For example, an increased risk of disease may be undesirable, while an increased probability of recovery may be beneficial. Also, an association between exposure and outcome does not necessarily establish causation.
How to Calculate Relative Risk: An Example
Example. A researcher conducted a cohort study involving 200 factory workers to investigate whether exposure to industrial dust was associated with developing respiratory symptoms over a 12-month period. The workers were divided into two groups based on their exposure status, and the results were summarized as follows.
| Exposure Status | Developed Respiratory Symptoms | Did Not Develop Symptoms | Total |
|---|---|---|---|
| Exposed | 40 | 60 | 100 |
| Unexposed | 20 | 80 | 100 |
| Total | 60 | 140 | 200 |
Calculate the relative risk of developing respiratory symptoms among exposed workers compared with unexposed workers.
Solution
By definition, the relative risk formula is: RR = [a / (a + b)] / [c / (c + d)]
From the table, we know that:
- a = 40
- b = 60
- c = 20
- d = 80.
Substituting the values into the formula:
Relative Risk, RR = [40 / (40 + 60)] / [20 / (20 + 80)]
= (40 / 100) / (20 / 100)
= 0.40 / 0.20
RR = 2.0000
Therefore, workers exposed to industrial dust had twice the risk of developing respiratory symptoms compared with unexposed workers.
Hypothesis Test for Relative Risk
A relative risk greater than or less than 1 does not automatically mean that the difference in risk between two groups is statistically significant. To determine whether the observed association is significant, we need to perform a hypothesis test.
For a 2 × 2 contingency table, we can use Pearson’s Chi-Square test or Fisher’s exact test, depending on the expected cell frequencies.
If all the expected cell frequencies are at least 5, use Pearson’s chi-square test. However, when one or more expected cell frequencies are less than 5, particularly when the sample is small, you should use Fisher’s exact test.
With our relative risk calculator, you don’t have to manually select Fisher’s exact test or chi-square test. The calculator automatically selects the appropriate test based on the expected cell frequencies and reports the corresponding p-value.
You can also perform these tests separately using the Chi-Square Test Calculator or Fisher’s Exact Test Calculator.
Example
Using the previous example, we found that workers exposed to industrial dust had twice the risk of developing respiratory symptoms compared with unexposed workers (RR = 2.0000).
Test whether this association is statistically significant at the 5% significance level.
Solution
We can perform the hypothesis test using the following six steps.
Step 1: State the hypotheses
The null and alternative hypotheses are:
- H₀: RR = 1. There is no association between exposure to industrial dust and developing respiratory symptoms.
- H₁: RR ≠ 1. There is an association between exposure to industrial dust and developing respiratory symptoms.
Step 2: Set the significance level
From the question, we need to test the hypothesis at a 5% significance level.
Therefore, α = 0.05.
Step 3: Calculate the test statistic
Before calculating the Chi-Square test statistic, we first check whether the expected cell frequencies are sufficiently large.
To do that, we use the expected frequency for each cell formula:
Expected Frequency = (Row Total × Column Total) / Grand Total
For instance, the expected frequency for the first cell, E₁₁ = (100 × 60) / 200
= 30
Similarly, the expected frequencies for the remaining cells are:
- E₁₂ = (100 × 140) / 200 = 70
- E₂₁ = (100 × 60) / 200 = 30
- E₂₂ = (100 × 140) / 200 = 70
Since all the expected frequencies are at least 5, we can use Pearson’s Chi-Square test.
For a 2 × 2 contingency table, the Chi-Square test statistic formula is:
Where N is the total number of observations.
Substituting the values into the formula:
= 200(3200 − 1200)² / 84,000,000
= 800,000,000 / 84,000,000
Therefore, χ² = 9.5238
The degrees of freedom are:
df = (Rows − 1)(Columns − 1)
= (2 − 1)(2 − 1)
= 1
Step 4: Find the p-value
To quickly find the p-value for the test, we use the p-value calculator or the p-value from the chi-square calculator and enter χ² = 9.5238 as the test statistic and df = 1. Using the tool, p-value = 0.0020
Step 5: Make a decision
Since the p-value (0.0020) is less than the significance level (0.05), we reject the null hypothesis (H₀).
Step 6: State the conclusion
At the 5% significance level, there is sufficient evidence to conclude that there is a statistically significant association between exposure to industrial dust and developing respiratory symptoms, χ²(1) = 9.5238, p = 0.0020. Therefore, workers exposed to industrial dust had twice the risk of developing respiratory symptoms compared with unexposed workers (RR = 2.0000).
How to Calculate a Confidence Interval for Relative Risk
Consider the previous example, where the observed frequencies were a = 40, b = 60, c = 20, and d = 80, giving a relative risk of 2.0000. Calculate the 95% confidence interval for the relative risk and determine whether the association is statistically significant at α = 0.05.
Solution
Recall. The confidence interval formula for relative risk is:
For a 95% confidence interval, α = 0.05, and the critical value is approximately 1.959964.
Substituting the values into the formula,
= exp[0.693147 ± 1.959964 × √0.055]
= exp[0.693147 ± 1.959964 × 0.234521]
CI = exp[0.693147 ± 0.459652]
Lower confidence limit = exp(0.693147 − 0.459652)
= exp(0.233495)
= 1.2630
Upper confidence limit = exp(0.693147 + 0.459652)
= exp(1.152799)
= 3.1670
Therefore, the 95% confidence interval for relative risk is (1.2630, 3.1670).
Interpretation
Recall that the null hypothesis states that the relative risk is equal to 1. To make a decision using a 95% confidence interval at the 5% significance level, we check whether the interval includes 1.
Since the confidence interval (1.2630, 3.1670) does not include 1, we reject the null hypothesis and conclude that exposed workers had a statistically significant higher risk of developing respiratory symptoms than unexposed workers. This is consistent with the p-value approach results.
Relative Risk vs. Odds Ratio
Relative risk and odds ratio are both used to measure associations between an exposure and an outcome, but they compare different quantities. While relative risk compares probabilities, the odds ratio compares odds.
For instance, in our example, the relative risk is 2.0000, while the odds ratio calculated from the same frequencies is 2.6667. Although the two measures are often close when the outcome is rare, they can differ considerably when the outcome is common.
Relative risk is generally appropriate for cohort studies and clinical trials where the probability of an outcome can be estimated directly. On the other hand, odds ratios are commonly used in case-control studies and logistic regression.
If your study requires an odds ratio rather than a risk ratio, use the Odds Ratio Calculator to calculate the odds ratio, confidence interval, and statistical significance.
Frequently Asked Questions
Yes. Relative risk and risk ratio refer to the same statistical measure. Both compare the probability of an outcome occurring in one group with the probability of the same outcome occurring in another group.
No. Relative risk cannot be negative because it is calculated from a ratio of nonnegative probabilities. However, its value can be zero, greater than zero, or undefined when the reference-group risk is zero.
When a cell frequency is zero, this relative risk calculator applies a 0.5 correction to obtain a finite relative risk estimate and an approximate confidence interval.
To calculate the relative risk reduction (RRR), we use the formula: RRR = (1 − RR) × 100%. For example, if RR = 0.75, RRR = (1 − 0.75) × 100%
= 25%
This means the exposed or treatment group has a 25% lower risk of the outcome compared with the reference group.
Relative risk compares the probabilities of an outcome between two groups as a ratio, while the absolute risk difference subtracts one probability from the other. For example, when the risks are 40% and 20%, the relative risk is 2, but the absolute risk difference is 20 percentage points.
In a conventional case-control study, participants are selected based on whether they have the outcome. Therefore, the proportion of cases in each exposure group does not generally represent the population risk. For this reason, the odds ratio is more suitable than the relative risk.
