statcompute

A/B testing

Relative Risk Calculator

How many times more likely an outcome is in one group — with the absolute difference beside it, which is usually the more honest number.

Updated August 2026Runs in your browser — nothing is uploadedVerified against R

The calculation runs in your browser, so this box needs JavaScript. The formula, the worked example and the interpretation below do not.

01

How to read this result

Relative risk is a ratio of probabilities, which makes it the more intuitive of the two ratio measures: RR = 2 means the outcome is twice as likely.

Relative risk without the baseline is the classic misleading statistic. Doubling a risk from one in a million to two in a million is RR = 2. The risk difference — reported above in percentage points — is what says whether the doubling matters.

The number needed to treat is the same information again, in the most concrete form: how many people would have to be exposed for one extra event to occur. It is 1 divided by the absolute risk difference.

It needs the rows to be the groups. Relative risk requires that risks be estimable, which means the study sampled groups and observed outcomes. In a case-control study the outcome counts are fixed by design, risk cannot be computed, and the odds ratio is the measure to use.

02

The formula

RR=a/(a+b)c/(c+d)CI=exp(lnRR±z1a1a+b+1c1c+d)
a/(a+b)
the risk in the first group
c/(c+d)
the risk in the second

As with the odds ratio, the interval is computed on the log scale and transformed back, which is why it is asymmetric.

03

Worked example

The same table, on the risk scale

The same 2×2 table as the odds ratio example: 30 of 100 exposed have the outcome, against 15 of 100 unexposed.

  1. The risk in each group.
    30/100 = 0.30 and 15/100 = 0.15
  2. Their ratio.
    RR = 0.30 / 0.15 = 2.00
  3. The standard error of ln(RR).
    √(1/30 − 1/100 + 1/15 − 1/100) = 0.2843
  4. The interval, exponentiated back.
    exp(0.6931 ± 1.96 × 0.2843) = 1.149 to 3.482
  5. The absolute difference, and its reciprocal.
    15 percentage points → 1/0.15 = 6.7 people
relative risk 2.0095% CI 1.15 to 3.48risk difference +15 ppnumber needed 7

“Twice the risk” and “an extra 15 cases per 100 people” describe the same table. The first sounds dramatic at any baseline; the second is the one that supports a decision.

Checked against the standard log-risk-ratio interval, computed in R.

The calculator above is loaded with these numbers by the Load the worked example button.

04

Assumptions, and when to use something else

  • The rows must be the comparison groups and the risks must be estimable — cohort or experimental designs, not case-control.
  • Independent observations and adequate counts for the log-normal interval.
  • A zero outcome count makes the ratio zero or undefined; the 0.5 correction is applied by default and the result is then approximate.

This is a general statistical tool. It is documented with a neutral exposure-and-outcome example because relative risk is used across quality control, insurance, engineering and marketing as well as epidemiology — and nothing here is medical advice or a clinical decision aid.

  • The study is case-controlOdds ratioWhen the outcome counts are fixed by design, risk cannot be computed and the odds ratio is the correct measure.
  • The counts are smallFisher's exact testExact inference for a small 2×2 table.
  • You want a significance testChi-square testTests the association in the same table.
  • You want the difference rather than the ratioz-test for proportionsThe difference in proportions with a confidence interval.
05

Questions people ask

What is the difference between relative risk and odds ratio?

Relative risk is a ratio of probabilities; the odds ratio is a ratio of odds. They converge when the outcome is rare and diverge when it is common — the odds ratio is always further from 1. Use relative risk when the design allows it.

What is the number needed to treat?

The reciprocal of the absolute risk difference: how many people must be exposed for one extra event to occur. A risk difference of 15 percentage points gives an NNT of about 7, which is a far more concrete statement than “twice the risk”.

Why can't I use relative risk in a case-control study?

Because the number of cases and controls is chosen by the researcher, so the proportion with the outcome in each exposure group is an artefact of the design rather than an estimate of risk. The odds ratio survives this, which is why it dominates that literature.

Is a relative risk of 1.5 large?

It depends entirely on the baseline. From 2% to 3% it is one extra case per hundred; from 20% to 30% it is ten. Always report the risk difference alongside the ratio — the calculator does both.