R - Metafor包计算和显示比值比而不是对数优势比

时间:2018-03-10 21:58:53

标签: r metafor

我基本上是想使用metafor包生成我的森林图。它目前效果非常好,除了它产生对数优势比的事实,而我想要纯粹的优势比本身。在metafor代码中有没有一种简单的方法呢?

#Metafor library
library(metafor)

#ReadXL library to import excel sheet
library(readxl)

#Name the data sheet from the excel file
ACDF<- read_excel("outpatient_ACDF_meta_analysis.xlsx")

#View the data sheet with view(ACDF)

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(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)

### 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()

感谢所有人的帮助!

2 个答案:

答案 0 :(得分:0)

setup.py函数中所述:

  

'measure'参数的选项是:

from cx_Freeze import setup, Executable
import sys
import os
from pathlib import Path

user_txt_path = []

if sys.platform=='win32':
    base = "Win32GUI"
    user_txt_path.append('chromedriver.exe')
    import os.path
    PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
    os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
    os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')
else:
    base = None
    user_txt_path.append('chromedriver')

buildOptions = {"include_files": [user_txt_path[0], 'u.pkl', 'tcl86t.dll', 'tk86t.dll'], "packages": ['encodings', "os"], "includes": ['numpy.core._methods', 'numpy.lib.format'], "excludes": []}

executables = [
    Executable('TachySloth.py', base=base, icon='sloth.ico')#base)
]

'''
home_path = str(Path.home())
pathname = str(os.path.dirname(sys.argv[0]))

#for initialization
f = open(home_path + user_txt_path[0], "w+")
for i in range(12):
     f.write("---\n")
'''

setup(name='TachySloth',
      version = 'beta',
      #description = 'test',
      #shortcutName="TachySloth",
      #shortcutDir="DesktopFolder",
      options = dict(build_exe = buildOptions),
      executables = executables
      )

出于这个原因,我猜你的问题的答案是否定的,因为没有escalc值会给你纯奇数比率和所有分析/数字使用纯比值比(OR)。如果你想要纯粹的我的猜测,你必须使用 • ‘"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来获得奇数比率和几个类似的微积分,以使所有结果以纯奇数比率表示。可能还有另一种我不知道的方式。

答案 1 :(得分:0)

实施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")"

让我知道它是否有效,如果您有任何其他问题!

相关问题