简体   繁体   English

如何绘制多元Survreg生成的生存曲线

[英]How to plot the survival curve generated by multi-variate survreg

This question follows on from the question here in that we want to plot a multi-variate model. 这个问题来自这里的问题,因为我们要绘制一个多变量模型。

Lets say we want to plot the Survival function from the example in survreg from the package release notes 假设我们要从软件包发行说明中的survreg示例中绘制Survival函数

Where the model is 模型在哪里

survreg(Surv(time, status) ~ ph.ecog + age + strata(sex), lung)

From what I understand the following problem seems to address the problem, but does not provide a data set and only uses one variable. 据我了解, 以下问题似乎可以解决该问题,但是它不提供数据集,仅使用一个变量。 Where in this example, we have two continuous variables and one factor 在此示例中,我们有两个连续变量和一个因子

Plot for the predicted survival curve for hypothetical individual with mean of lung$age and the mode of lung$ph.ecog (following the example in the help page): 用肺年龄平均值和肺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)

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM