我想计算一个脆弱的考克斯比例风险模型的预测幸存者功能[使用生存包]。看起来当脆弱项在模型中时,无法计算预测的幸存者功能。
## Example
require(survival)
data(rats)
## Create fake weight
set.seed(90989)
rats$weight<-runif(nrow(rats),0.2,0.9)
## Cox model with gamma frailty on litter
fit <- coxph(Surv(time, status) ~ rx+weight+frailty(litter,dist="gamma"),
data = rats)
## Compute survival curve from the cox model for rx=0 and weight=0.5 kg
plot(survfit(fit, newdata=data.frame(rx=0,weight=0.5)),xlab = "time",
ylab="Survival")
## Running this line, I get following error message:
Error in survfit.coxph(fit, newdata = data.frame(rx = 0, weight = 0.5)) :
Newdata cannot be used when a model has sparse frailty terms
我尝试通过选项同时使用稀疏和非稀疏计算方法
sparse=TRUE, Sparse =FALSE, sparse =0, sparse=5
。但是,没有一个有效。
如何根据我的脆弱模型计算预测的幸存者曲线?