我想使用 metafor::rma() 作为 ggplot 的平滑器。我已经尝试了各种方法来让它继续运行,但似乎都没有奏效。这是一个最小(非)工作示例:
# Libraries
library(metafor)
library(ggplot2)
# Some data preparation
dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg)
# Scatterplot of the data
figure1 <- ggplot(dat, aes(y = yi, x = ablat)) + geom_point()
figure1
# Various attempts that lead to various error messages :(
figure2a <- ggplot(dat, aes(y = yi, x = ablat)) +
geom_point() + geom_smooth(method = metafor::rma())
figure2b <- ggplot(dat, aes(y = yi, x = ablat)) +
geom_point() + geom_smooth(method = metafor::rma(y = yi, vi = vi))
figure2c <- ggplot(dat, aes(y = yi, x = ablat)) +
geom_point() + geom_smooth(method = metafor::rma(y = dat$yi, vi = dat$vi))
figure2d <- ggplot(dat, aes(y = yi, x = ablat)) +
geom_point() + geom_smooth(method = metafor::rma(yi = yi, vi = vi, data = dat), formula = yi ~ ablat)
figure2e <- ggplot(dat, aes(y = yi, x = ablat)) +
geom_point() + geom_smooth(method = metafor::rma(), method.args = list(yi = dat$yi, vi = dat$vi, method = "EB"))
我究竟做错了什么?谢谢