提问人:John 提问时间:10/21/2023 最后编辑:John 更新时间:10/21/2023 访问量:30
Cox 回归中的断点
Breakpoints in Cox Regression
问:
我正在尝试使用 R 中的包来识别 Cox PH 模型中的断点/更改点。具体来说,我感兴趣的是找到最佳断点数,然后估计断点。segmented
这是我的代码的一个工作示例:
library(survival)
library(segmented)
cox_model <- coxph(Surv(time, status)~age+pat.karno+meal.cal, data=lung)
os<-segmented.default(cox_model, ~age, psi=c(60, 70), n.boot=50) # estimate the breakpoint in the age effect
通过为 psi 提供更多值(例如,我注意到标识了更多的断点。有没有办法让函数自动确定最佳断点数?c(60, 65, 70)
编辑:
显然,该函数可以帮助解决这个问题,但是我不确定如何在 Cox 模型上应用它。在下面找到我的代码:selgmented
cox_model <- coxph(Surv(time, status)~age+pat.karno+meal.cal, data=lung)
os <-selgmented(cox_model, Kmax=10, type="bic") #BIC-based selection
它给了我以下错误:
Error in bic.values[1] <- BIC.f(olm) + 1 : replacement has length zero
In addition: Warning messages:
1: In min(Z) : no non-missing arguments to min; returning Inf
2: In max(Z) : no non-missing arguments to max; returning -Inf
我用错了吗?
答: 暂无答案
评论