我要做的是在来自 MICE 的 5 个估算数据集上拟合 5 个 Kaplan Meier 曲线。我的目标是在每个时间点取 5 个生存概率的平均值。我认为如果我有构成每条 KM 曲线的阶跃函数的确切形式,这将很容易,但我不知道如何提取它。
这是我将运行的代码示例
#make up data
survival_time=rexp(10,3)
dead=sample(c(0,1),10,replace=TRUE)
gender=sample(c(0,1),10,replace=TRUE)
#induce missingness in gender
gender[3:5]=NA
data=cbind(survival_time,dead,gender)
#do imputation
imp=mice(data)
#fit KM curves on each of the imputed datasets
km_fit=with(imp,survfit(Surv(survival_time,dead)~gender))
#now break down each km curve into male and female
#and average the surv prob at each time
#but how?
挑战在于生存时间和死亡指标始终是固定的,但每个性别的数量在插补之间会发生变化。正因为如此,每组中的数量,因此事件的数量和时间在插补之间发生变化。
我的计划是什么,假设我可以得到阶跃函数,那就是在阶跃函数上使用 apply predict 来获得手段。这是最好的解决方案,还是您认为会有更好的解决方案?