Background
My question concerns the calculation of risk ratios and odds ratios for meta-analysis using the metafor
package. I know it looks long, but please bear with me, as it is a simple question. I've simply provided a lot of background information. First, copy/paste the below to make my example data.
# Load package
library(metafor)
# Create example_data
example_data <-
data.frame(
trial = c(1, 2, 3, 4, 5, 6),
author = c("Abers", "Baker", "Cook", "Dodds", "Eggers", "Fritz"),
year = c(2000, 2001, 2002, 2003, 2004, 2005),
tpos = c(437, NA, 51, 26, 468, 10),
tneg = c(49, NA, 1, 8, 83, 1),
cpos = c(50, 7, 6, 0, 36, 0),
cneg = c(33, 8, 0, 0, 19, 0)
)
# Show example_data
example_data
trial author year tpos tneg cpos cneg
1 1 Abers 2000 437 49 50 33
2 2 Baker 2001 NA NA 7 8
3 3 Cook 2002 51 1 6 0
4 4 Dodds 2003 26 8 0 0
5 5 Eggers 2004 468 83 36 19
6 6 Fritz 2005 10 1 0 0
More background
If I were to make a two-by-two table by hand for the first study, Abers, it would look as follows:
pos neg
pos 437 49
neg 50 33
The relative risk would be calculated by hand as follows:
RR = (437/(437 + 49)) / (50/(50 + 33)) = 1.49
log(RR) = 0.40
The odds ratio would be calculated by hand as follows:
OR = (437 * 33) / (50 * 49) = 5.89
log(OR) = 1.77
Here are the forest plots for log(RR) and log(OR). If you look at the first line in each plot, you can see that metafor
produces the same values as I did by hand for the Abers study.
My question
Take a look at the line for Dodds on the plots. Where are these values for log(RR) and log(OR) coming from? As I see it, if I were to make a two-by-two table for the Dodds, it would look as follows:
pos neg
pos 26 8
neg 0 0
The relative risk would be calculated by hand as follows:
RR = (26/(26 + 8)) / (0/(0 + 0)) = Undefined! As you cannot divide by zero.
log(RR) = ?
The odds ratio would be calculated by hand as follows:
OR = (26 * 0) / (0 * 8) = Again, undefined!
log(OR) = ?
So how did the metafor
package calculate a log(RR) of 0.41 and a log(OR) of 1.14 for the Dodds study? And more generally, for all of my studies with zero values (e.g., Cook, Dodds, and Fritz), can I even include any of them in my meta-analysis?