首页 > 解决方案 > JM 的jointModel 使用左截断数据引发错误

问题描述

我收到与时间相关的 cox 模型的以下错误。不确定是什么问题。它既不适用于教科书中的示例,也不适用于我的数据。

关节模型中的错误(lmeFit.pbc,tdCox.pbc,timeVar = "year",method = "spline-PH-aGH"):在 coxph() 中使用参数 'model = TRUE' 和 cluster()。

library("JM") 

library("lcmm") 

pbc <- pbc2[c("id", "serBilir", "drug", "year", "years",
              "status2", "spiders")]

pbc$start <- pbc$year

splitID <- split(pbc[c("start", "years")], pbc$id)
pbc$stop <- unlist(lapply(splitID,
            function (d) c(d$start[-1], d$years[1]) ))

pbc$event <- with(pbc, ave(status2, id,
             FUN = function (x) c(rep(0, length(x)-1), x[1]) ))


lmeFit.pbc <- lme(log(serBilir) ~ drug * (year + I(year^2)),
                  random = ~ year + I(year^2) | id, data = pbc2)

tdCox.pbc <- coxph(Surv(start, stop, event) ~ drug * spiders + cluster(id),
                   data = pbc, x = TRUE, model = TRUE)

jointFit8.pbc <- jointModel(lmeFit.pbc, tdCox.pbc, timeVar = "year",
                            method = "spline-PH-aGH")

summary(jointFit8.pbc)

标签: rcox-regression

解决方案


推荐阅读