How to calculate the “exact confidence interval” for relative risk?

I am working on some MRSA data and need to calculate the relative risk of a group of hospitals compared with the remaining hospital.

My colleagues throws me an excel with a formula inside to calculate the "exact confidence interval of relative risk", I can do the calculation without difficulties, but I have no idea on how and why this formula is used for do such calculation.

I have attached the excel file here for your reference.

Can anyone show me a reference on the rationale of the calculation? Article from textbooks will be fine to me. Thanks!

• You need to change your question as many people won't (and shouldn't) run a random excel file on their computer. Pull out the formula from the file and ask a question about that. – csgillespie Aug 11 '10 at 11:06

3 Answers

Check out the R Epi and epitools packages, which include many functions for computing exact and approximate CIs/p-values for various measures of association found in epidemiological studies, including relative risk (RR). I know there is also PropCIs, but I never tried it. Bootstraping is also an option, but generally these are exact or approximated CIs that are provided in epidemiological papers, although most of the explanatory studies rely on GLM, and thus make use of odds-ratio (OR) instead of RR (although, wrongly it is often the RR that is interpreted because it is easier to understand, but this is another story).

You can also check your results with online calculator, like on statpages.org, or Relative Risk and Risk Difference Confidence Intervals. The latter explains how computations are done.

By "exact" tests, we generally mean tests/CIs not relying on an asymptotic distribution, like the chi-square or standard normal; e.g. in the case of an RR, an 95% CI may be approximated as $\exp\left[ \log(\text{rr}) - 1.96\sqrt{\text{Var}\big(\log(\text{rr})\big)} \right], \exp\left[ \log(\text{rr}) + 1.96\sqrt{\text{Var}\big(\log(\text{rr})\big)} \right]$, where $\text{Var}\big(\log(\text{rr})\big)=1/a - 1/(a+b) + 1/c - 1/(c+d)$ (assuming a 2-way cross-classification table, with $a$, $b$, $c$, and $d$ denoting cell frequencies). The explanations given by @Keith are, however, very insightful.

For more details on the calculation of CIs in epidemiology, I would suggest to look at Rothman and Greenland's textbook, Modern Epidemiology (now in it's 3rd edition), Statistical Methods for Rates and Proportions, from Fleiss et al., or Statistical analyses of the relative risk, from J.J. Gart (1979).

You will generally get similar results with fisher.test(), as pointed by @gd047, although in this case this function will provide you with a 95% CI for the odds-ratio (which in the case of a disease with low prevalence will be very close to the RR).

Notes:

1. I didn't check your Excel file, for the reason advocated by @csgillespie.
2. Michael E Dewey provides an interesting summary of confidence intervals for risk ratios, from a digest of posts on the R mailing-list.

There is no single exact confidence interval for the ratio of two proportions. Generally speaking, an exact 95% confidence interval is any interval-generating procedure that guarantees at least 95% coverage of the true ratio, irrespective of the values of the underlying proportions.

An interval formed by the Fisher Exact Test is probably overly conservative -- in that it has MORE than 95% coverage for most values of the parameters. It's not wrong but it's also wider than it has to be.

The interval used by the StatXact software with the default settings would be a better choice here -- I believe it uses some variety of Chan interval (i.e. an extremum-searching interval using the Berger-Boos procedure and a standardized statistic), but would need to check the manual to be sure.

When you ask for the "how and why" -- does this answer your question? I think we could certainly expound further about the definition of confidence intervals and how to construct one from scratch if that's what you were looking for. Or does it do the trick just to say that this is a Fisher Exact Test-based interval, one (but not the only and not the most powerful) of the confidence intervals that guarantees its coverage unconditionally?

(Footnote: Some authors reserve the word "exact" to apply only to intervals and tests where false-positives are controlled at exactly alpha, instead of merely bounded by alpha. Taken in this sense, there simply isn't a deterministic exact confidence interval for the ratio of two proportions, period. All of the deterministic intervals are necessarily approximate. Of course, even so some intervals and tests do unconditionally control Type I error and some don't.)

This seems to be Fisher's Exact Test for Count Data. You can reproduce the results in R by giving:

data <- matrix(c(678,4450547,63,2509451),2,2)
fisher.test(data)

data:  data
p-value < 2.2e-16
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
4.682723 7.986867
sample estimates:
odds ratio
6.068817