我正在尝试绘制网络荟萃分析的结果。我已经成功地生成了每种治疗相对于安慰剂的等级概率。但是,当我调用forest(relative.effect(results.rank))时遇到以下错误:
Error in result[["model"]] : subscript out of bounds
我意识到这个论坛上有很多与“下标越界”有关的问题,但是我所申请的都没有充分解决我的问题。
我是否可以知道此错误是否意味着我标记变量的方式有问题,或者我是否需要forest(relative effect(results.rank))
在行中指定以某种方式扩大范围?
非常感谢任何指导。
12 月 29 日更新....为最小的上下文道歉,这是我的代码:
library(gemtc)
library(rjags)
library(readxl)
df<-read_xlsx("...Book1.xlsx")
#Create network model#
nw<-mtc.network(data.ab=df, treatments=unique(df$treatment))
#Build model#
nw.model <- mtc.model(nw,
linearModel = "random",
n.chain = 4,
type="consistency",
likelihood='binom',
link="logit")
#Run MCMC#
nw.mcmc <- mtc.run(nw.model, n.adapt = 50, n.iter = 10000, thin = 10)
#Rank treatments#
nw.rank<-rank.probability(nw.mcmc, preferredDirection = -1)
#Plot relative effect#
forest(relative.effect(nw.rank))
我的这个问题的数据是:
study<-c("Jones", "Jones", "Prieto", "Prieto", "Scott", "Scott", "Mickle", "Mickle", "Yang", "Yang", "Zhao", "Zhao")
sampleSize<-c(3886, 3876, 218, 214, 2040, 2014, 137, 137, 683, 683, 221, 230)
responders<-c(114, 94, 3, 8, 30, 20, 1, 4, 9, 11, 1, 2)
treatment<-c("dx1", "px1", "rx1", "tx1", "rx1", "ax1", "zx1", "tx1", "gx1", "tx1", "ax1", "px1")
df<-as.data.frame(study, sampleSize, responders, treatment)