# [R] Confidence interval for relative risk

From: Michael Dewey <info_at_aghmed.fsnet.co.uk>
Date: Fri 10 Nov 2006 - 14:43:27 GMT
• fisher.test example ===

> outcome <- matrix(c(500, 0, 500, 8), ncol = 2, byrow = TRUE)
> fisher.test(outcome)

Fisher's Exact Test for Count Data

data: outcome
p-value = 0.00761
alternative hypothesis: true odds ratio is not equal to 1 95 percent confidence interval:
1.694792 Inf
sample estimates:
odds ratio

Inf

• end example ===

but in epidemiology authors often
prefer to present risk ratios.

Using the facility on CRAN to search
the site I find packages epitools and Epi which both offer confidence intervals
for the risk ratio

• Epi example ===

> library(Epi)
> twoby2(outcome[c(2,1),c(2,1)])

2 by 2 table analysis:

Outcome : Col 1
Comparing : Row 1 vs. Row 2
```       Col 1 Col 2    P(Col 1) 95% conf. interval
Row 1     8   500      0.0157    0.0079   0.0312
Row 2     0   500      0.0000    0.0000      NaN

95% conf. interval
Relative Risk:    Inf       NaN      Inf
Sample Odds Ratio:    Inf       NaN      Inf
Conditional MLE Odds Ratio:    Inf    1.6948      Inf
Probability difference: 0.0157    0.0027   0.0337

Exact P-value: 0.0076
Asymptotic P-value: NaN
------------------------------------------------------

```
• end example ===

So Epi gives me a lower limit of NaN but the same confidence interval and p-value as fisher.test

• epitools example ===

> library(epitools)
> riskratio(outcome)

\$data

Outcome
Predictor Disease1 Disease2 Total

```   Exposed1      500        0   500
Exposed2      500        8   508
Total        1000        8  1008

\$measure
risk ratio with 95% C.I.
Predictor  estimate lower upper
Exposed1        1    NA    NA
Exposed2      Inf   NaN   Inf

\$p.value
two-sided
Predictor  midp.exact fisher.exact  chi.square
Exposed1         NA           NA          NA
```
Exposed2 0.00404821 0.007610478 0.004843385

\$correction
[1] FALSE attr(,"method")
[1] "Unconditional MLE & normal approximation (Wald) CI" Warning message:
Chi-squared approximation may be incorrect in: chisq.test(xx, correct = correction)

And epitools also gives a lower limit
of NaN.

• end all examples ===

I would prefer not to have to tell the authors of the paper I am refereeing that
I think they are wrong unless I can help them with what they should have done.

Is there another package I should have tried?

Is there some other way of doing this?

Am I doing something fundamentally wrong-headed?

Michael Dewey
http://www.aghmed.fsnet.co.uk

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat Nov 11 01:53:01 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 23 Nov 2006 - 00:30:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.