如何在使用coxphf()的同时合并偏移变量

发布于 2025-02-01 02:01:23 字数 1281 浏览 4 评论 0原文

library(coxphf)
library(survival)
im <- data.frame(X1 <- c(0.482, 0.283, 0.806, 0.510, 0.828, 0.675, 0.430, 0.743,
                         0.285, 0.954, 0.323, 0.349, 0.338, 0.818, 0.688), 
                 X2 <- c(0.750, 0.690, 0.604, 0.566, 0.770, 0.022, 0.475, 0.052,
                         0.259, 0.604, 0.946, 0.052, 0.292, 0.052, 0.058),
                 X3 <- c(0.798, 0.082, 0.177, 0.506, 0.047, 0.506, 0.759, 0.711,
                         0.876, 0.773, 0.075, 0.799, 0.327, 0.711, 0.614),
                 X4 <- c(0.444, 0.440, 0.679, 0.167, 0.553, 0.647, 0.239, 0.417,
                         0.945, 0.000, 0.859, 0.216, 0.069, 0.885, 0.786),
                 y <- c( 1.494,  1.143,  1.362,  7.256,  2.759,  1.788, 23.941,
                         5.174,  3.025, 15.585,  0.296, 26.531,  1.932, 3.404, 1.324),
                 failed <- c(1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1,0))

coxphf(Surv(y, failed)~offset(X1)+X2+X3+X), data=im)    #does not work
coxph(Surv(y, failed)~offset(X1)+X2+X3+X4, data=im)     #returns results

我试图将Cox模型与Firth惩罚(通过包装coxphf下的Coxphf())一起使用,同时将第一个变量(任何一个)作为偏移。它返回错误:“错误:protect():保护堆栈溢出。” 我通过coxph()函数获得了相应的结果。 是否有任何方法可以将偏移术语合并到Coxphf()函数中? 鉴于生存:: basehaz()不适合coxphf拟合,我该如何估计基线危害?

library(coxphf)
library(survival)
im <- data.frame(X1 <- c(0.482, 0.283, 0.806, 0.510, 0.828, 0.675, 0.430, 0.743,
                         0.285, 0.954, 0.323, 0.349, 0.338, 0.818, 0.688), 
                 X2 <- c(0.750, 0.690, 0.604, 0.566, 0.770, 0.022, 0.475, 0.052,
                         0.259, 0.604, 0.946, 0.052, 0.292, 0.052, 0.058),
                 X3 <- c(0.798, 0.082, 0.177, 0.506, 0.047, 0.506, 0.759, 0.711,
                         0.876, 0.773, 0.075, 0.799, 0.327, 0.711, 0.614),
                 X4 <- c(0.444, 0.440, 0.679, 0.167, 0.553, 0.647, 0.239, 0.417,
                         0.945, 0.000, 0.859, 0.216, 0.069, 0.885, 0.786),
                 y <- c( 1.494,  1.143,  1.362,  7.256,  2.759,  1.788, 23.941,
                         5.174,  3.025, 15.585,  0.296, 26.531,  1.932, 3.404, 1.324),
                 failed <- c(1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1,0))

coxphf(Surv(y, failed)~offset(X1)+X2+X3+X), data=im)    #does not work
coxph(Surv(y, failed)~offset(X1)+X2+X3+X4, data=im)     #returns results

I am trying to fit the Cox model with Firth penalization (through coxphf() under package coxphf) while keeping the first variable(any one) as offset. It returns error: "Error: protect(): protection stack overflow."
I am getting corresponding results with the coxph() function.
Is there any way to incorporate an offset term in the coxphf() function?
Also how can I estimate the baseline hazard, given that the survival::basehaz() does not work for a coxphf fit?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文