【发布时间】:2019-03-10 17:05:41
【问题描述】:
我正在使用 TWANG 匹配 3 个治疗组,我可以生成图 1 和图 2(此处显示 https://cran.r-project.org/web/packages/twang/vignettes/mnps.pdf),但不幸的是,我无法生成图 3 来评估加权前后的绝对标准化平均差 (ASMD))
这是我的代码:
mnps.newtest1.ATE <- mnps(ttt_gps.3gp.Neo.Adj.dCRT ~ AGE + SEX +
Race_2psW.O + CDCC_2gps01.2 + Histology_3gps +
TUMOR_SIZE_R + YEAR_OF_DIAGNOSIS,
data = testdf2,
n.trees=10000,
interaction.depth=2,
shrinkage=0.01,
perm.test.iters=0,
stop.method=c("es.mean","ks.mean"),
estimand = "ATE",
verbose=F)
警告信息:在 ps(formula = currFormula, data = currDat, n.trees = n.trees[i], :最佳迭代次数接近指定的 n.trees。 n.trees 可能设置得太小,平衡性更好 可以通过将 n.trees 设置得更大来获得。
plot(mnps.newtest1.ATE, plots = 3)
*****矩阵中的错误(unlist(value,recursive = FALSE,use.names = FALSE),nrow = nr,:'dimnames' [2] 的长度不等于数组 范围另外:警告消息:在 is.na(e2) 中:is.na() 应用于 'NULL'类型的非(列表或向量)*****
然后在谷歌搜索此错误后,我在 1 个网站 (length of 'dimnames' [2] not equal to array extent when using corrplot function from a matrix read from a csv file) 上找到了此解决方案,但它还不起作用
plot(as.matrix(mnps.newtest1.ATE), plots = 3)
if (length(treatments) > 2 & x$estimand == "ATE") stop("The \"treatments\" 参数必须为 null 或长度为 1 或 2。") :
参数长度为零
任何帮助将不胜感激
【问题讨论】: