Confidence intervals

Confidence interval for the ratio of proportions

Calculate the confidence interval for the quotient of two independent proportions, also called relative risk when the proportions are risks.

Calculator

Enter events and sample sizes for two independent groups to estimate the ratio \(p_1/p_2\).

Result pending…

Explanation

The ratio of proportions compares two independent proportions using a quotient. If the proportions represent risks or cumulative incidences, the same calculation is interpreted as relative risk (RR).

For example, if the occurrence of an event is compared between exposed and unexposed groups, the 2x2 table can be written as follows:

Group With event Without event Proportion
Group 1 / exposed x₁ = 35 n₁ − x₁ = 65 p̂₁ = 35/100 = 0.35
Group 2 / unexposed x₂ = 20 n₂ − x₂ = 80 p̂₂ = 20/100 = 0.20

The point estimate is the quotient of the two proportions:

\( \widehat{RR} = \dfrac{\hat{p}_1}{\hat{p}_2} = \dfrac{x_1/n_1}{x_2/n_2} \)

A value equal to 1 indicates equal proportions. Values greater than 1 indicate that group 1's proportion is higher; values less than 1 indicate that it is lower.

Logarithmic method for the ratio of proportions

Let \(C\) denote the confidence level and \(\alpha=1-C\) the total area outside the interval. For 95% confidence, \(C=0.95\), \(\alpha=0.05\) and \(\alpha/2=0.025\) in each tail.

The interval is built on a logarithmic scale because the ratio can only take positive values and its distribution is usually skewed. On the \(\log(RR)\) scale, the normal approximation is more stable for moderate or large samples.

First \(\widehat{RR} = (x_1/n_1)/(x_2/n_2)\) is computed. Then the standard error of \(\log(\widehat{RR})\) is estimated with:

\( SE\left[\log(\widehat{RR})\right] = \sqrt{\dfrac{1}{x_1}-\dfrac{1}{n_1}+\dfrac{1}{x_2}-\dfrac{1}{n_2}} \)

The two-sided interval on the logarithmic scale is:

\( \log(\widehat{RR}) \pm z_{\alpha/2}\cdot SE\left[\log(\widehat{RR})\right] \)

Finally, the exponential is applied to both limits. The final result is on the original scale of the ratio of proportions and is interpreted by comparing it with the null value 1.

Zero-cell correction

If either group has no events, \(\log(\widehat{RR})\) cannot be computed directly. The 0.5 correction option adds 0.5 to the four cells of the 2x2 table before computing proportions, ratio and interval.

Worked example

With x₁ = 35, n₁ = 100, x₂ = 20 and n₂ = 100:

\( \widehat{RR} = \dfrac{35/100}{20/100} = 1.75 \)

For 95% confidence, \(C=0.95\), \(\alpha=0.05\), \(\alpha/2=0.025\) and \(z_{0.025} \approx 1.960\). The standard error on the logarithmic scale is:

\( SE = \sqrt{\dfrac{1}{35}-\dfrac{1}{100}+\dfrac{1}{20}-\dfrac{1}{100}} \approx 0.242 \)

Since \(\log(1.75) \approx 0.560\), the interval on the logarithmic scale is:

\( 0.560 \pm 1.960\cdot0.242 \approx [0.085,\;1.034] \)

Transforming with the exponential:

\( CI_{95\%}(RR) = [e^{0.085},\;e^{1.034}] \approx [1.089,\;2.812] \)

Since the interval does not include 1, group 1's proportion is significantly higher than group 2's at 95% confidence.

Assumptions for the ratio of proportions

  • The two groups must be independent and have real risk or proportion denominators.
  • Within each group, observations must be binary and independent.
  • The logarithmic method needs positive events in both groups; if either group has 0 events, use the 0.5 correction and interpret with caution.
  • The normal approximation of \(\log(RR)\) works better with moderate or large samples and non-extreme counts.

How does it differ from the CI for odds ratio?

Although this calculator and the CI for odds ratio both use a logarithmic scale and compare the interval with the null value 1, they estimate different measures.

Measure What it compares Formula in a 2x2 table Typical use
Ratio of proportions / relative risk (RR) Probabilities or proportions of the event in two groups. \( RR = \dfrac{x_1/n_1}{x_2/n_2} \) Cohorts, trials, A/B experiments, or studies with real risk denominators.
Odds ratio (OR) Odds of the event: cases with the event divided by cases without it. \( OR = \dfrac{a/b}{c/d} = \dfrac{a\cdot d}{b\cdot c} \) Case-control studies, logistic regression, and analyses that model odds.

With the same example data (35 events and 65 non-events in group 1; 20 events and 80 non-events in group 2), this tool computes \(RR=(35/100)/(20/100)=1.75\). The odds ratio tool would compute \(OR=(35/65)/(20/80)\approx2.154\).

RR answers "how many times greater is the probability of the event." OR answers "how many times greater are the odds of the event." If the event is rare, both values tend to be similar; if the event is common, OR can be considerably larger than RR and should not be interpreted as a relative risk.

How to interpret the result

The interval \([L, U]\) is the plausible range of the population ratio of proportions \(RR = p_1/p_2\) given the chosen confidence level. The null value is 1, indicating equal proportions (\(p_1 = p_2\)). In frequentist terms: if you repeated the study many times with the same sample sizes and built the CI with the same procedure, a proportion \(C\) of those intervals would contain the true ratio. As with the odds ratio, the interval is built symmetrically on the logarithmic scale and then transformed with the exponential; this produces an asymmetric CI on the original scale (the distance from \(\widehat{RR}\) to \(L\) is not equal to the distance from \(\widehat{RR}\) to \(U\)).

The interpretation follows three cases. If \(1 \in [L, U]\), the data are compatible with equal proportions at the chosen confidence level; the test \(H_0\!: p_1 = p_2\) would not be rejected at level \(\alpha = 1 - C\). If \(L > 1\), group 1's proportion is significantly higher. If \(U < 1\), group 1's proportion is significantly lower. The chart shows the approximate normal distribution of \(\log(RR)\): the green region is the confidence zone and the red tails (area \(\alpha/2\) each) delimit the critical values \(\pm z_{\alpha/2}\) on the logarithmic scale.

  • Multiplicative scale: an \(RR = 1.75\) means group 1's proportion is 75% higher than group 2's, not 75 percentage points higher. The difference between the additive scale (difference of proportions) and the multiplicative scale (ratio) matters for communicating results.
  • Difference from odds ratio: RR compares proportions directly. OR compares odds. With the same example (35/100 versus 20/100), \(RR = 1.75\) but \(OR \approx 2.15\). If the event is rare, both converge; if the event is common, OR can be much more extreme than RR and should not be used to estimate relative risks.
  • Width and counts: the standard error of \(\log(RR)\) grows when the event counts (\(x_1\), \(x_2\)) are small. With few events in either group, the interval will be very wide and imprecise; if either group has 0 events, applying the 0.5 correction is mandatory.

Frequently asked questions

  • What is the null value? In a ratio of proportions, the null value is 1.
  • Is it the same as the difference of proportions? No. The difference uses an additive scale \(p_1-p_2\); the ratio uses a multiplicative scale \(p_1/p_2\).
  • When is it interpreted as relative risk? When \(p_1\) and \(p_2\) represent risks, cumulative incidences, or event probabilities over a defined period.

References used

  • Katz, D., Baptista, J., Azen, S. P. and Pike, M. C. (1978). Obtaining confidence intervals for the risk ratio in cohort studies, Biometrics, 34, 469–474.
  • Agresti, A. (2013). Categorical Data Analysis. Wiley.
  • Rothman, K. J., Greenland, S. and Lash, T. L. (2008). Modern Epidemiology. Lippincott Williams & Wilkins.