library(gemtc) #这个是贝叶斯网状meta分析的包
library(rjags) #rjags是要额外下载安装的一个吉布斯采样软件
library(tidyverse)
description <- data.frame(id=(LETTERS[1:10]),description=(LETTERS[1:10]))
mydata <- data.frame(study=c("1","1","1","1","2","2","2","2","3","3","3","3","4","4","4","5","5","5","5"),treatment=c("A","B","C","D","A","D","C","B","A","C","D","E","A","F","G","A","H","I","J"),diff=c(NA, -0.520, -0.374, -0.369, NA, -0.380, -0.320, -0.590, NA, -0.720, -0.340, -0.490, NA, -0.300, -0.130, NA, 0.370, 0.090, -0.010),std.err=c(0.126, 0.180, 0.180, 0.180, 0.133, 0.190, 0.190, 0.190, 0.150, 0.216, 0.217, 0.214, 0.090, 0.130, 0.130, 0.300, 0.440, 0.410,0.430))
description$id <- description$id %>% as.character()
#绘制网状图、进行异质性分析,network的格式是mtc.network
network <- mtc.network(data.re=mydata, treatments = description, description = 'Network')
hg <- mtc.anohe(network, factor=2.5, n.chain=4, likelihood="normal",linearModel="random",link="identity")
#在运行mtc.anohe时报错:Error in network[[network]] : invalid subscript type 'list'
#但是去掉下面这两行之后莫名就能运行了?
mydata <- mydata[-15,]
description <- description[-7,]
查过资料说是把list改成向量或数据框即可,但由于“network”是特殊的格式,改了就没法跑了,想问下这个报错怎么解决?