绘制生存曲线
我是 R 新手,正在尝试绘制 survfit
生存曲线。
在使用 survfit
对象时,我发现我得到了以下 2 个不同的图:
library(survival)
#example survfit object
mysurvfit <- survfit(Surv(time, status)~1, data=aml)
#default survfit plot, survival curve with upper & lower conf intervals
plot(mysurvfit, mark.time=FALSE, conf.int=TRUE)
#create another curve by accessing surv, upper, lower
#(I'd expect this to produce the same as above, but it doesn't)
lines(mysurvfit$surv, col="blue",lty=1)
lines(mysurvfit$upper, col="blue",lty=2)
lines(mysurvfit$lower, col="blue",lty=2)
为什么这些曲线不同?我对 survfit 对象缺少什么?
I'm new to R and am trying to plot survfit
survival curves.
In playing around with the survfit
object, I found that I get 2 different plots for the following:
library(survival)
#example survfit object
mysurvfit <- survfit(Surv(time, status)~1, data=aml)
#default survfit plot, survival curve with upper & lower conf intervals
plot(mysurvfit, mark.time=FALSE, conf.int=TRUE)
#create another curve by accessing surv, upper, lower
#(I'd expect this to produce the same as above, but it doesn't)
lines(mysurvfit$surv, col="blue",lty=1)
lines(mysurvfit$upper, col="blue",lty=2)
lines(mysurvfit$lower, col="blue",lty=2)
Why are these curves different? What am I missing about the survfit object?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您缺少
time
变量Try
,它看起来像
You are missing the
time
variableTry
which looks like