#R语言实现网状Meta
library(gemtc)
help(package="gemtc")
data<-gemtc::smoking #注意按照实例格式编写数据
net<-mtc.network(data$data.ab)
#网状图
plot(net,mode="circle",displaylabels=T,boxed.label=F)
summary(net)
#网状model
model<-mtc.model(net,type="consistency",#"consistency", "regression", "nodesplit", "ume", or "use")
n.chain=4,#Number of chains in the model
likelihood="binom",#The likelihood to be used. If unspecified, a suitable likelihood will be inferred for the given data.
link="logit",#The link function to be used. If unspecified, a suitable link function will be inferred for the given data.
linearModel="random")#"random" or "fixed"
#软件选取及迭代
result<-mtc.run(model,
sample="rjags",#采样方法"rjags"
n.adapt=20000,#自适应(或调整)迭代次数
n.iter=5000,#模拟迭代次数
thin=1)#间隔
summary(result)
#绘制森林图
forest(relative.effect(result,"A"))
#收敛诊断图
par(mfrow=c(2,2))
gelman.plot(result,auto.layout = F)
#轨迹和密度图
plot(result)
#排序图
ranks<-rank.probability(result)
sucra(ranks)
plot(ranks)
plot(ranks,beside=T)
#联赛表
liansai<-relative.effect.table(result)
library(xlsx)
write.xlsx(liansai,file="联赛图.xlsx")
#异质性检验
hererogeneity<-mtc.anohe(net)
hereo<-summary(hererogeneity)
plot(hereo)#敏感性分析森林图