r - 在 R 中使用 msSurv 包

标签 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 .

真诚感谢任何帮助。

最佳答案

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

关于r - 在 R 中使用 msSurv 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55913410/

相关文章:

r - 在同一图表R上绘制两个图,ggplot2 par(mfrow())

r - 从 R 中涉及两年的时间段中提取一年

R/Shiny Downloadhandler 结果被截断的 .csv 文件

r - 在没有 `$` 的情况下访问网状 Python 对象

machine-learning - sklearn TfidfVectorizer : Generate Custom NGrams by not removing stopword in them

r - 如何用ggplot绘制堆积的条形图?

r - 在 super 计算机上并行化,然后合并并行结果 (R)

r - 使用 survminer (ggsurvplot) 将 Kaplan-Meier 图 y 轴更改为失败概率而不是生存概率?

survival-analysis - 生存分析中的对数转换预测变量

r - Cox回归中分层变量的参数估计和方差(层/生存包)