在R中使用msSurv软件包

时间:2019-04-30 02:59:42

标签: r statistics survival-analysis

我正在尝试将msSurv用于多状态建模问题,该问题着眼于个人向不同阶段的过渡。其中一部分是创建一个树对象,我认为这是我犯错的地方,但我不明白它是什么。我将在此处包括最小可行的示例。

Nodes <- c("1", "2", "3", "4", "5", "6")
Edges <- list("1" = list(edges = c("2", "3", "4", "5", "6")),
"2" = list(edges = c("1", "3", "4", "5", "6")),
"3" = list(edges = c("1", "2", "4", "5", "6")),
"4" = list(edges = c("1", "2", "3", "5", "6")),
"5" = list(edges = c("3", "4", "6")),
"6" = list(edges = NULL))
treeobj <- new("graphNEL", nodes = Nodes, edgeL = Edges, edgemode = "directed")
fit3 <- msSurv(df, treeobj, bs = TRUE, LT = TRUE)

我得到的错误如下。

No states eligible for exit distribution calculation.
Entry distributions calculated for states 6 .
Error in bs.IA[, , j, b] : subscript out of bounds

可以找到here的数据集。

衷心感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

我可能会误会,但是您的6组没有1-6作为优势,因此程序返回错误,因为从本质上讲您是在说6与计算无关。关于解决方案,我认为6应该有边,因为在这一行中可能需要有边:"6" = list(edges = NULL))