R - Metafor 包——计算和显示比值比而不是对数比值比
R - Metafor package–calculate and display odds ratio instead of log odds ratio
我主要是想使用 metafor 包生成我的森林图。它目前工作得非常好,除了它产生对数比值比的事实,而我想要纯比值比本身。在 metafor 代码中是否有一种简单的方法可以做到这一点?
#Metafor library
library(metafor)
#ReadXL library to import excel sheet
library(readxl)
#Name the data sheet from the excel file
abcd<- read_excel("analysis.xlsx")
#View the data sheet with view(abcd)
dpi=600 #pixels per square inch
tiff("metaor.tif", width=6*dpi, height=5*dpi, res=dpi)
#This below measures with risk ratios. If you want to measure odds ratios, use argument measure=OR
returnop <- escalc(measure="OR", ai=op_return_OR, bi=op_no_return_OR, ci=ip_return_OR, di=ip_no_return_OR, data=ACDF)
#Generate a Random Effects Model
REmodel<-rma(yi=yi, vi=vi, data=returnop, slab=paste(Author, Year, sep=", "), method="REML")
#Generate a forest plot of the data
forest(REmodel, xlim=c(-17, 6),
ylim=c(-1, 10),
ilab=cbind(abcd$op_return_OR, abcd$op_no_return_OR, abcd$ip_return_OR,
abcd$ip_no_return_OR),
ilab.xpos=c(-10,-8.4,-6.6,-4.9), cex=.75,
psize=1)
### add column headings to the plot
text(c(-10,-8.4,-6.6,-4.9), 8.5, c("Return+", "Return-", "Return+", "Return-"),
cex = 0.65)
text(c(-9.25,-5.75), 9.5, c("Outpatient", "Inpatient"))
text(-17, 8.5, "Study", pos=4)
text(6, 8.5, "Log Odds Ratio [95% CI]", pos=2)
dev.off()
感谢大家的帮助!
如 escalc
函数中所述:
The options for the ‘measure’ argument are then:
• ‘"RR"’ for the _log risk ratio_.
• ‘"OR"’ for the _log odds ratio_.
• ‘"RD"’ for the _risk difference_.
• ‘"AS"’ for the _arcsine square root transformed risk
difference_ (Rücker et al., 2009).
• ‘"PETO"’ for the _log odds ratio_ estimated with Peto's
method (Yusuf et al., 1985).
Note that the log is taken of the risk ratio and the odds
ratio, which makes these outcome measures symmetric around 0
and yields corresponding sampling distributions that are
closer to normality.
出于这个原因,我想你的问题的答案是否定的,因为没有 measure
值可以给你纯比值比,所有 analysis/figures 使用纯比值比 (OR) .如果你想要纯或,我猜你必须使用 exp()
,例如 exp(returnop$yi)
来获得奇数比和一些类似的微积分来使所有结果以纯奇数比表示。可能还有另一种我不知道的方法。
实现forest()
功能时,添加"atransf = exp"
参数。
应该这样做。
"forest(REmodel, xlim=c(-17, 6), ylim=c(-1, 10),
ilab=cbind(ACDF$op_return_OR, ACDF$op_no_return_OR, ACDF$ip_return_OR,
ACDF$ip_no_return_OR), ilab.xpos=c(-10,-8.4,-6.6,-4.9), cex=.75,
psize=1, atransf="exp")"
让我知道它是否有效,如果您有任何其他问题!
我主要是想使用 metafor 包生成我的森林图。它目前工作得非常好,除了它产生对数比值比的事实,而我想要纯比值比本身。在 metafor 代码中是否有一种简单的方法可以做到这一点?
#Metafor library
library(metafor)
#ReadXL library to import excel sheet
library(readxl)
#Name the data sheet from the excel file
abcd<- read_excel("analysis.xlsx")
#View the data sheet with view(abcd)
dpi=600 #pixels per square inch
tiff("metaor.tif", width=6*dpi, height=5*dpi, res=dpi)
#This below measures with risk ratios. If you want to measure odds ratios, use argument measure=OR
returnop <- escalc(measure="OR", ai=op_return_OR, bi=op_no_return_OR, ci=ip_return_OR, di=ip_no_return_OR, data=ACDF)
#Generate a Random Effects Model
REmodel<-rma(yi=yi, vi=vi, data=returnop, slab=paste(Author, Year, sep=", "), method="REML")
#Generate a forest plot of the data
forest(REmodel, xlim=c(-17, 6),
ylim=c(-1, 10),
ilab=cbind(abcd$op_return_OR, abcd$op_no_return_OR, abcd$ip_return_OR,
abcd$ip_no_return_OR),
ilab.xpos=c(-10,-8.4,-6.6,-4.9), cex=.75,
psize=1)
### add column headings to the plot
text(c(-10,-8.4,-6.6,-4.9), 8.5, c("Return+", "Return-", "Return+", "Return-"),
cex = 0.65)
text(c(-9.25,-5.75), 9.5, c("Outpatient", "Inpatient"))
text(-17, 8.5, "Study", pos=4)
text(6, 8.5, "Log Odds Ratio [95% CI]", pos=2)
dev.off()
感谢大家的帮助!
如 escalc
函数中所述:
The options for the ‘measure’ argument are then:
• ‘"RR"’ for the _log risk ratio_. • ‘"OR"’ for the _log odds ratio_. • ‘"RD"’ for the _risk difference_. • ‘"AS"’ for the _arcsine square root transformed risk difference_ (Rücker et al., 2009). • ‘"PETO"’ for the _log odds ratio_ estimated with Peto's method (Yusuf et al., 1985). Note that the log is taken of the risk ratio and the odds ratio, which makes these outcome measures symmetric around 0 and yields corresponding sampling distributions that are closer to normality.
出于这个原因,我想你的问题的答案是否定的,因为没有 measure
值可以给你纯比值比,所有 analysis/figures 使用纯比值比 (OR) .如果你想要纯或,我猜你必须使用 exp()
,例如 exp(returnop$yi)
来获得奇数比和一些类似的微积分来使所有结果以纯奇数比表示。可能还有另一种我不知道的方法。
实现forest()
功能时,添加"atransf = exp"
参数。
应该这样做。
"forest(REmodel, xlim=c(-17, 6), ylim=c(-1, 10),
ilab=cbind(ACDF$op_return_OR, ACDF$op_no_return_OR, ACDF$ip_return_OR,
ACDF$ip_no_return_OR), ilab.xpos=c(-10,-8.4,-6.6,-4.9), cex=.75,
psize=1, atransf="exp")"
让我知道它是否有效,如果您有任何其他问题!