use*_*991 5 plot r survival-analysis weibull
这个问题是从这里的问题而来的 ,因为我们想要绘制一个多变量模型。
假设我们要绘制包发行说明survreg中示例中的生存函数
模型在哪里
survreg(Surv(time, status) ~ ph.ecog + age + strata(sex), lung)
Run Code Online (Sandbox Code Playgroud)
据我了解,以下问题似乎解决了该问题,但没有提供数据集并且仅使用一个变量。在此示例中,我们有两个连续变量和一个因子
绘制假设个体的预测生存曲线,其平均值为ung$age,众数为ung$ph.ecog(按照帮助页面中的示例):
?predict.survreg
pct <- 1:98/100
ptime <- predict(res, newdata=data.frame(ph.ecog=1, age=62.44737, sex=1), type='quantile',
p=pct, se=TRUE)
matplot(cbind(ptime$fit, ptime$fit + 2*ptime$se.fit,
ptime$fit - 2*ptime$se.fit)/30.5, 1-pct,
xlab="Months", ylab="Survival", type='l', lty=c(1,2,2), col=1)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1263 次 |
| 最近记录: |