如何修复“选择了未定义的列"用于 R 中的网络元分析? [英] how to fix "undefined columns selected" for network meta-analysis in R?
问题描述
我正在使用两个包 gemtc 和 rjags 对 R 进行网络元分析.但是,当我输入
I am conducting a network meta-analysis on R with two packages, gemtc and rjags. However, when I type
Model <- mtc.model (network, linearmodel=’fixed’).
R 总是返回
[.data.frame(data, sel1 | sel2, columns, drop = FALSE) 中的错误:
选择了未定义的列此外:警告消息:1:在mtc.model(network, linearModel = "fixed") : 似然不能推断.默认为正常.2:在 mtc.model(network, linearModel ="fixed") :无法推断链接.默认为身份
Error in [.data.frame(data, sel1 | sel2, columns, drop = FALSE) :
undefined columns selected In addition: Warning messages: 1: In mtc.model(network, linearModel = "fixed") : Likelihood can not be inferred. Defaulting to normal. 2: In mtc.model(network, linearModel = "fixed") : Link can not be inferred. Defaulting to identity "
如何解决这个问题?谢谢!
How to fix this problem? Thanks!
我在这里附上我的代码和数据:
I am attaching my codes and data here:
SAE <- read.csv(file.choose(),head=T, sep=",")
head(SAE)
network <- mtc.network(data.ab=SAE)
summary(network)
plot(network)
model.fe <- mtc.model (network, linearModel="fixed")
plot(model.fe)
summary(model.fe)
cat(model.fe$code)
model.fe$data
# run this model
result.fe <- mtc.run(model.fe, n.adapt=0, n.iter=50)
plot(result.fe)
gelman.diag(result.fe)
result.fe <- mtc.run(model.fe, n.adapt=1000, n.iter=5000)
plot(result.fe)
gelman.diag(result.fe)
以下是我的数据:SAE
following is my data: SAE
study treatment responder sample.size
1 1 3 0 76
2 1 30 2 72
3 2 3 99 1389
4 2 23 132 1383
5 3 1 6 352
6 3 30 2 178
7 4 2 6 106
8 4 30 3 95
9 5 3 49 393
10 5 25 18 198
11 6 1 20 65
12 6 22 10 26
13 7 1 1 76
14 7 30 3 76
15 8 3 7 441
16 8 26 1 220
17 9 2 1 47
18 9 30 0 41
19 10 3 10 156
20 10 30 9 150
21 11 1 4 85
22 11 25 5 85
23 11 30 4 84
24 12 3 6 152
25 12 30 5 160
26 13 18 4 158
27 13 21 8 158
28 14 1 3 110
29 14 30 2 111
30 15 3 3 83
31 15 30 1 92
32 16 1 3 124
33 16 22 6 123
34 16 30 4 125
35 17 3 236 1553
36 17 23 254 1546
37 18 6 5 398
38 18 7 6 403
39 19 1 64 588
40 19 22 73 584
推荐答案
如何阅读手册?mtc.model
.它清楚地说明了以下内容:
How about reading the manual ?mtc.model
. It clearly states the following:
必填列 [响应者,样本大小]
Required columns [responders, sampleSize]
所以你的 responder
变量应该是 responders
而你的 sample.size
变量应该是 sampleSize
.
So your responder
variable should be responders
and your sample.size
variable should be sampleSize
.
接下来,您的 plot(network)
应该可以帮助您确定无法进行某些比较.在您的数据中,比较了 2 个试验亚组.未将处理 18 和 21 与任何其他处理进行比较.因此,您只能对 21 和 18 进行元分析或对其余部分进行网络元分析.
Next, your plot(network)
should help you determine that some comparisons can not be made. In your data, there are 2 subgroups of trials that were compared. Treatment 18 and 21 were not compared with any of the others. Therefore you can only do a meta-analysis of 21 and 18 or a network meta-analysis of the rest.
network <- mtc.network(data.ab=SAE[!SAE$treatment %in% c(21, 18), ])
model.fe <- mtc.model(network, linearModel="fixed")
这篇关于如何修复“选择了未定义的列"用于 R 中的网络元分析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!