Relative Risk Calculation with DataStatPro: Zero to Hero Tutorial
This tutorial takes you from the meaning of risk through relative risk calculation, confidence intervals, absolute risk difference, number needed to treat, calculator use, interpretation, reporting, and common mistakes. It is designed for cohort studies, clinical trials, outbreak cohorts, and other designs where risks can be directly estimated.
Table of Contents
- Prerequisites and Background Concepts
- What Is Relative Risk?
- When to Use Relative Risk
- The Mathematics Behind Relative Risk
- Assumptions and Data Requirements
- Using the Relative Risk Calculator
- Interpreting Results
- Worked Examples
- Common Mistakes and How to Avoid Them
- Troubleshooting
- Quick Reference Cheat Sheet
1. Prerequisites and Background Concepts
1.1 Risk
Risk is the probability that an outcome occurs in a defined population over a defined time period:
The time period must be stated. A 5% risk over 1 month is not the same as a 5% risk over 10 years.
1.2 Exposed and Unexposed Groups
Relative risk compares two groups:
- Exposed or intervention group.
- Unexposed or comparison group.
The groups must have clear denominators, meaning you know how many people were at risk in each group.
1.3 The 2x2 Table
| Outcome + | Outcome - | Total | |
|---|---|---|---|
| Exposure + | a | b | a + b |
| Exposure - | c | d | c + d |
Risk in the exposed group is . Risk in the unexposed group is .
2. What Is Relative Risk?
Relative risk (RR), also called the risk ratio, compares the probability of an outcome in the exposed group with the probability in the unexposed group:
Interpretation:
| RR value | Meaning |
|---|---|
| RR = 1 | Equal risk in both groups |
| RR > 1 | Higher risk in exposed group |
| RR < 1 | Lower risk in exposed group |
Relative risk is intuitive because it speaks directly in terms of probability.
3. When to Use Relative Risk
Use relative risk when:
- The study is a cohort study.
- The study is a randomized trial.
- You are analyzing an outbreak cohort.
- You know the denominators in exposed and unexposed groups.
- You can estimate incidence or attack rate in each group.
Do not use RR as the primary measure for ordinary case-control studies because the number of cases and controls is fixed by design, so disease risk is not directly estimated.
| Study design | Recommended measure |
|---|---|
| Prospective cohort | RR, risk difference, rate ratio |
| Retrospective cohort | RR if denominators are known |
| Randomized trial | RR, risk difference, NNT |
| Outbreak cohort | Attack rate ratio |
| Case-control | Odds ratio |
4. The Mathematics Behind Relative Risk
4.1 Risks in Each Group
4.2 Relative Risk Formula
4.3 Confidence Interval
The log-scale standard error is commonly estimated as:
The confidence interval is:
4.4 Risk Difference
Relative risk should often be paired with an absolute measure:
4.5 Number Needed to Treat or Harm
For beneficial interventions:
For harmful exposures:
Always state the time horizon.
5. Assumptions and Data Requirements
Relative risk assumes:
- Participants were at risk at the start of follow-up.
- Outcome status is measured consistently in both groups.
- Follow-up time is comparable, or risk rather than rate is truly appropriate.
- Observations are independent.
- Loss to follow-up is not strongly related to both exposure and outcome.
- The exposure precedes the outcome when causal language is used.
If follow-up time differs substantially, use incidence rates or survival methods.
6. Using the Relative Risk Calculator
Step-by-Step Guide
Step 1: Define the question.
Example: "Did vaccination reduce flu risk during the season?"
Step 2: Confirm that risk can be estimated.
You need denominators for exposed and unexposed groups.
Step 3: Build the 2x2 table.
| Outcome + | Outcome - | |
|---|---|---|
| Exposure + | a | b |
| Exposure - | c | d |
Step 4: Enter raw counts.
Do not enter percentages unless a field explicitly asks for them.
Step 5: Review RR and absolute measures.
Look at RR, confidence interval, risk difference, and NNT/NNH when provided.
Step 6: Write a report sentence.
Example:
The risk of flu was lower in vaccinated people than in unvaccinated people (RR = 0.25, 95% CI [0.18, 0.34]); the absolute risk difference was -15 percentage points over one flu season.
7. Interpreting Results
7.1 Relative Direction
- RR = 2: exposed group has twice the risk.
- RR = 0.5: exposed group has half the risk.
- RR = 1: no relative difference.
7.2 Confidence Interval
The null value for RR is 1. A 95% CI that excludes 1 is statistically incompatible with equal risk at the 0.05 level.
7.3 Absolute Impact
Relative risk alone can be misleading. Always inspect risk difference:
| Example | RR | Risk difference |
|---|---|---|
| 1% to 2% | 2.0 | 1 percentage point |
| 30% to 60% | 2.0 | 30 percentage points |
Same RR, very different public health meaning.
8. Worked Examples
Example 1: Vaccine Effectiveness
| Flu | No flu | |
|---|---|---|
| Vaccinated | 50 | 950 |
| Unvaccinated | 200 | 800 |
Vaccine effectiveness is:
The risk difference is:
The NNT is:
Round up: about 7 people need vaccination to prevent one flu case over the season.
Example 2: Smoking and Heart Disease
| Heart disease | No heart disease | |
|---|---|---|
| Smokers | 120 | 880 |
| Non-smokers | 40 | 1960 |
Smokers had six times the risk of heart disease during follow-up. The absolute risk difference was 10 percentage points.
Example 3: Outbreak Attack Rate Ratio
| Ill | Not ill | |
|---|---|---|
| Ate potato salad | 40 | 40 |
| Did not eat | 10 | 110 |
The attack rate among exposed attendees was six times the attack rate among unexposed attendees.
9. Common Mistakes and How to Avoid Them
Mistake 1: Using RR for Case-Control Data
Case-control studies do not directly estimate disease risk. Use odds ratio instead.
Mistake 2: Ignoring Absolute Risk
RR can sound dramatic even when the absolute increase is tiny. Report RD too.
Mistake 3: Omitting the Follow-Up Period
Risk must be tied to time. State whether the risk is over 30 days, 1 year, 10 years, or another period.
Mistake 4: Confusing Protective and Harmful Direction
RR below 1 indicates lower risk in the exposed group. Be clear whether "exposure" is a harmful factor or a protective intervention.
Mistake 5: Ignoring Loss to Follow-Up
Unequal loss to follow-up can bias the observed risks.
10. Troubleshooting
| Problem | Likely cause | What to do |
|---|---|---|
| RR is undefined | Zero outcome count in comparison group | Use exact methods or report instability |
| RR seems inverted | Exposure rows reversed | Re-check table orientation |
| NNT is negative | Exposure increases rather than decreases risk | Interpret as NNH or reverse outcome direction |
| Very wide CI | Small sample or rare outcome | Report imprecision; consider larger sample |
| RR differs strongly from OR | Outcome is common | Prefer RR for cohort interpretation |
| Risk estimate seems biased | Unequal follow-up | Consider rate ratio or survival analysis |
11. Quick Reference Cheat Sheet
Core Formula
Confidence Interval
Companion Measures
Interpretation
| RR | Meaning |
|---|---|
| 1 | Equal risk |
| > 1 | Higher risk in exposed group |
| < 1 | Lower risk in exposed group |
Reporting Template
Over [time period], the risk of [outcome] was [higher/lower] in [exposed group] than in [comparison group] (RR = [value], 95% CI [lower, upper]); the absolute risk difference was [value].
Final Checklist
- Confirm denominators are known.
- Confirm exposure preceded outcome.
- Enter raw counts.
- Report RR with CI.
- Add risk difference.
- State the time period.
- Use NNT/NNH only with a clear outcome direction.