绘制混合效应 Cox 回归和/或时间交互作用的调整生存曲线?

问题描述 投票:0回答:1

我使用 coxme 创建了混合效应 cox 回归。

Q1) 我想在调整后的生存曲线中绘制固定效应的系数。然而,像

survminer
这样的包中的这个功能似乎只适用于没有脆弱项的 coxph 对象。

是否可以在 R 中手动计算和绘制?

我有以下模型用于演示目的:

library(survival)
library(coxme)
kidney <-  data.frame(kidney)

coxme <- coxme(Surv(time, status) ~ age + sex + (1|disease), 
                  data = kidney)

Q2)此外,是否可以将其绘制为时间交互(

tt()
in
coxph
)?

以模型为例:

library(survival)
kidney <-  data.frame(kidney)

coxph.me <- coxph(Surv(time, status) ~ age + sex + tt(sex) + frailty(disease), 
                  data = kidney,
                  tt=function(x,t,...) x*t)

提前致谢

r mixed-models survival-analysis cox-regression survival
1个回答
0
投票

从模型中获取调整后的生存曲线的最流行方法是 g 计算,它需要一个函数在给定协变量向量和 t 的情况下预测 t 处的生存概率。不幸的是,

coxme
函数自然不支持这样的预测,例如包装中没有包含
predict.coxme
功能。

但是,如果您从

adjustedCurves
切换到带有
riskRegression
术语的标准
coxme
模型,则可以将
coxph
包与
frailty()
包结合使用来获得所需的内容。下面我举一个例子来说明如何做到这一点。由于
riskRegression
中的错误,它有点 hacky,但它工作得很好。

library(riskRegression)
library(adjustedCurves)
library(survival)

set.seed(42)

# simulate some example data
sim_dat <- sim_confounded_surv(n=500, max_t=1.2)
sim_dat$group <- as.factor(sim_dat$group)
sim_dat$cluster <- sample(1:10, size=nrow(sim_dat), replace=TRUE)

# outcome model
# NOTE: your frailty term needs to be named "cluster" due to some
#       sub-optimal coding in the riskRegression package
cox_mod <- coxph(Surv(time, event) ~ x1 + x2 + x4 + x5 + group + 
                   frailty(cluster),
                 data=sim_dat, x=TRUE)

predict_fun <- function(...) {
  1 - predictRisk(...)
}

# using direct adjustment 
adjsurv <- adjustedsurv(data=sim_dat,
                        variable="group",
                        ev_time="time",
                        event="event",
                        method="direct",
                        outcome_model=cox_mod,
                        predict_fun=predict_fun)

plot(adjsurv)

如果您还需要置信区间,您可以通过稍微更改代码来使用引导来获得置信区间(请注意,这可能需要一段时间,特别是如果您有大量数据)。

# using direct adjustment with bootstrap confidence intervals
adjsurv <- adjustedsurv(data=sim_dat,
                        variable="group",
                        ev_time="time",
                        event="event",
                        method="direct",
                        bootstrap=TRUE,
                        n_boot=500,
                        outcome_model=cox_mod,
                        predict_fun=predict_fun)

plot(adjsurv, conf_int=TRUE, use_boot=TRUE)

这些都不适用于模型公式中的

tt()
项。

© www.soinside.com 2019 - 2024. All rights reserved.