### load BCG vaccine data
data(dat.bcg)
### meta-analysis of the log relative risks using a random-effects model
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg,
data=dat.bcg, measure="RR", method="REML")
### standard funnel plot
funnel(res)
### funnel plot with relative risk values on the x-axis
funnel(res, atransf=exp, at=log(c(.12, .25, .5, 1, 2)))
### contour-enhanced funnel plot centered at 0 (see Peters et al., 2008)
funnel(res, level=c(90, 95, 99), shade=c("white", "gray", "darkgray"),
refline=0, atransf=exp, at=log(c(.10, .25, .5, 1, 2, 4, 10)))
### mixed-effects model with absolute latitude in the model
res <- rma(ai=tpos, bi=tneg, ci=cpos, di=cneg, mods=ablat,
data=dat.bcg, measure="RR", method="REML")
### funnel plot of the residuals
funnel(res)
### simulate a large meta-analytic dataset (correlations with rho = 0.2)
### with no heterogeneity or publication bias; then try out some various
### versions of the funnel plot
gencor <- function(rhoi, ni) {
x1 <- rnorm(ni, mean=0, sd=1)
x2 <- rnorm(ni, mean=0, sd=1)
x3 <- rhoi*x1 + sqrt(1-rhoi^2)*x2
cor(x1, x3)
}
k <- 200 ### number of studies to simulate
ni <- round(rchisq(k, df=2) * 20 + 20) ### simulate sample sizes (skewed distribution)
ri <- mapply(gencor, rep(0.2,k), ni) ### simulate correlations
res <- rma(ri=ri, ni=ni, measure="ZCOR", method="FE")
funnel(res, yaxis="sei")
funnel(res, yaxis="vi")
funnel(res, yaxis="seinv")
funnel(res, yaxis="vinv")
funnel(res, yaxis="ni")
funnel(res, yaxis="ninv")
funnel(res, yaxis="sqrtni")
funnel(res, yaxis="sqrtninv")
funnel(res, yaxis="lni")
Run the code above in your browser using DataLab