r - 使用 curve() 绘制 survreg 的生存和风险函数

标签 r plot survival-analysis weibull parametric-equations

我有以下 survreg 模型:

Call:
survreg(formula = Surv(time = (ev.time), event = ev) ~ age, 
    data = my.data, dist = "weib")
             Value Std. Error    z        p
(Intercept) 4.0961     0.5566 7.36 1.86e-13
age         0.0388     0.0133 2.91 3.60e-03
Log(scale)  0.1421     0.1208 1.18 2.39e-01
Scale= 1.15 

Weibull distribution

我想绘制 危险 函数和 生存函数基于上述估计。
我不想用 predict()pweibull() (如此处 Parametric Survival 或此处 SO question 所示。

我想用curve()功能。我有什么想法可以做到这一点吗? survreg 的 Weibull 函数似乎使用了不同于通常的尺度和形状定义(与 rweibull 不同)。

更新:我想我真正需要它来表达作为估计函数的危险/生存Intercept , age (+ other potential covariates) , Scale不使用任何现成的 *weilbull功能。

最佳答案

你的参数是:
scale=exp(Intercept+beta*x)在你的例子中,让我们说年龄 = 40

scale=283.7

您的形状参数是模型输出的比例的倒数
shape=1/1.15

那么危害是:
curve((shape/scale)*(x/scale)^(shape-1), from=0,to=12,ylab=expression(hat(h)(t)), col="darkblue",xlab="t", lwd=5)

累积风险函数为:
curve((x/scale)^(shape), from=0,to=12,ylab=expression(hat(F)(t)), col="darkgreen",xlab="t", lwd=5)

生存函数是 1-累积风险函数,所以:
curve(1-((x/scale)^(shape)), from=0,to=12,ylab=expression(hat(S)(t)), col="darkred",xlab="t", lwd=5, ylim=c(0,1))

另请查看 eha包和函数 hweibullHweibull
Weibull Functions

关于r - 使用 curve() 绘制 survreg 的生存和风险函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16236939/

相关文章:

r - xtable:添加了额外的列,并且使用对齐参数时出错

r - 如何通过列名向量对数据框进行排序?

matlab - 我的处女帖 : Having trouble with ind2rgb function in matlab

r - 使用 randomForestSRC 在特定时间点的生存概率

r - 如何获得survdiff返回的p值

r - ggplot2/ggsurvplot : Vectorized input to `element_text()` is not officially supported

r - 更改ggplot图例的布局

r - Spark : Error in validate_java_version_line(master, 版本)

r - 奇怪的阿布林行为

r - 如何使用基本 R 图为数据中不存在的日期添加轴刻度