Relative Risk Calculator
Two proportions into a relative risk, the risk difference and a 95 % interval, with both risks printed.
What the relative risk calculator does
It divides the risk in one group by the risk in another. The exposed risk is a ÷ n₁, the unexposed risk is c ÷ n₂, and the relative risk is their quotient; the risk difference is printed beside it because a ratio and a difference answer different questions.
Twenty cases among one hundred exposed give a risk of 0.2; ten among one hundred unexposed give 0.1. The relative risk is 2 and the risk difference is 0.1. The page also prints ln(RR), its standard error √(1/a − 1/n₁ + 1/c − 1/n₂), and a 95 % interval of exp(ln RR ± 1.96·SE), here 0.9866 to 4.0545.
Each total must be at least 1 and the cases must not exceed it, because a risk above 1 is not a risk. Both case counts must be at least 1: a zero numerator makes the log interval undefined, so the page refuses it and names the zero rather than applying a continuity correction on the visitor's behalf.
This is arithmetic on two proportions. It makes no claim about cause, study design or clinical meaning, and it does not adjust for anything. Those judgements belong to the reader and the study, not to the page.
The case counts and totals are whole numbers from 1 to 1 000 000. A fractional count, cases above the total and a non-numeric value are refused by name.
Figures print to up to four decimal places with trailing zeros trimmed.
How to use it
Enter Exposed cases and Exposed total, then Unexposed cases and Unexposed total.
Press Run. The result prints both risks, the relative risk, the risk difference, ln RR, its standard error and the 95 % interval.
Worked example
Input with the defaults:
20 of 100 exposed, 10 of 100 unexposed
Output:
Risk, exposed: 0.2 (20 ÷ 100)
Risk, unexposed: 0.1 (10 ÷ 100)
Relative risk: 2 (exposed risk ÷ unexposed risk)
Risk difference: 0.1 (exposed − unexposed)
95% CI: 0.9866 … 4.0545
Why it runs in your browser
The two risks and the interval are computed in this tab. Your counts are never uploaded.
The page divides the risk in one group by the risk in another. Twenty cases among one hundred exposed give a risk of 0.2; ten among one hundred unexposed give 0.1, so the relative risk is 2 and the risk difference is 0.1.
ln(RR), its standard error √(1/a − 1/n₁ + 1/c − 1/n₂) and a 95 % interval of exp(ln RR ± 1.96·SE) are printed with both risks. With these defaults the interval runs from 0.9866 to 4.0545.
The ratio and the difference are both printed because they answer different questions: how many times more common, and how many more per hundred. Reporting one without the other hides half the picture.
Risk, relative risk and risk difference
A risk is the number of cases divided by the number of people at risk in that group. The relative risk divides one group's risk by the other's; the risk difference subtracts one from the other. A relative risk of 2 doubles the risk, and a risk difference of 0.1 adds ten cases per hundred people.
The same relative risk can hide very different absolute differences. Doubling a risk of 0.0001 adds one case in ten thousand; doubling a risk of 0.2 adds twenty in a hundred. That is why both lines are printed.
Why both case counts must be at least one
The standard error of ln(RR) contains 1/a and 1/c, so a zero case count makes it undefined. The page refuses such a table and names the zero rather than applying a continuity correction silently.
Cases above the group total are refused too: a risk above 1 is not a risk. Both checks name the two values that disagree, so a transposed total is easy to spot.
How to use Relative Risk Calculator
Enter Exposed cases and Exposed total.
Enter Unexposed cases and Unexposed total.
Press Run. The result prints both risks, the relative risk, the risk difference, ln RR, its standard error and the 95 % interval.
What to Expect
Best for
- Comparing two risks from known group totals
- Reporting a relative risk and an absolute difference together
- Checking a published risk ratio from its counts
Not ideal for
- A case-control design, where the risk ratio is not estimable and the odds ratio is used
- An adjusted risk ratio controlling for other variables
- A zero case count, which needs a decision about a correction first
What this tool keeps
- The four counts you entered
- Both group totals
What may need cleanup
- Person-time denominators, which this page does not convert to a risk
- A zero case count, which must be corrected deliberately before entry
Common errors
- Entering cases instead of totals in the total fields
- Reading the relative risk as an absolute change
Example use cases
- Reading a cohort table
- Explaining why a ratio needs a baseline risk beside it
- Checking a reported relative risk from raw counts
Sample input
20 cases of 100 exposed and 10 cases of 100 unexposed.
Sample output
Risks of 0.2 and 0.1, a relative risk of 2, a risk difference of 0.1 and a 95 % interval from 0.9866 to 4.0545.
Who this is for
- Students reading a cohort study table
- Analysts checking a reported risk ratio
Frequently asked questions
Why print the risk difference as well as the ratio?
Because a ratio without a baseline hides the absolute size. Doubling a risk of 0.001 and doubling a risk of 0.2 are both a relative risk of 2, and they mean very different things for a hundred people.
Can I use this for a case-control study?
No. A case-control design fixes the number of cases and controls, so the group risks are not estimable. The odds ratio is the measure used there, and the odds-ratio page computes it.
What if a group has no cases?
The page refuses it, because the standard error of ln(RR) divides by the case count. If you have decided a 0.5 correction is right, apply it to both case counts and both totals and enter the corrected table.
Does a relative risk of 2 mean the exposure caused the outcome?
No. The page is arithmetic on two proportions. Whether the exposure caused the outcome depends on the study design and on things this table does not contain, and the result line says it makes no causal claim.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.