How to extract infos from metafor forest plot or escalc() function ?


I want to calculate CI for log Risk Ratio, but do not know how to do it with escalc() from metafor, or how to extract RR with Confidence Intervals from forest plot. Any help much appreciated.

Here is the code:

data("", package = "metafor")
dat <- escalc(measure = "RR", ai = tpos, bi = tneg, ci = cpos, di = cneg, data =, append = TRUE)
res <- rma(ai = tpos, bi = tneg, ci = cpos, di = cneg, data = dat, measure = "RR")
forest(res, slab = paste(dat$author, dat$year, sep = ", "), xlim = c(-16, 6), at = log(c(0.05, 0.25, 1, 4)), 
atransf = exp, ilab = cbind(dat$tpos, dat$tneg, dat$cpos, dat$cneg), ilab.xpos = c(-9.5, -8, -6, -4.5), cex = 0.75)
op <- par(cex = 0.75, font = 2)
text(c(-9.5, -8, -6, -4.5), 15, c("TB+", "TB-", "TB+", "TB-"))
text(c(-8.75, -5.25), 16, c("Vaccinated", "Control"))
text(-16, 15, "Author(s) and Year", pos = 4)
text(6, 15, "Relative Risk [95% CI]", pos = 2)

kind regards,

I am asking kindly again, anybody can help, I need this:

I move this up in case anybody get the idea.

Hi Andrzej,
I get the feeling we do not have many members who know much about {metafor} . I don't. I have not worked on a meta-analysis since sometime in the 1980's. There is a specialized mailing list, R-sig-meta-analysis -- R Special Interest Group for Meta-Analysis that may be a better place to ask this question.

I am sorry not to be of more help.

Is this of any use?
Extract the Model Coefficients and Coefficient Table from 'rma' and 'summary.rma' Objects

Thank you for your reply,
I try to get it done as forest plot is just a big list, so I try to find which element of list is it ?

I have never used that list but on the basic Rmailing list where I am a member. the process is to register and just send an email to the list asking for help.

I'm struggling with calculating confidence intervals for the log risk ratio using the escalc() function from the metafor package. I have my data formatted, but I'm unsure about the correct parameters and syntax to use in the escalc() function. I'm having difficulty extracting the log risk ratio along with its confidence intervals from the forest plot generated with the forest() function.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.