本篇来介绍另外一种生存模型:加速失效时间模型(Accelerated Failure Time Model,AFT模型)。AFT模型是对生存时间进行建模的。它常使用在工业领域,如研究零件寿命受温度的影响,因此把生存时间称为失效时间(Failure Time)。

本篇目录如下:

  • 1 AFT模型

    • 1.1 符号说明

    • 1.2 模型形式

    • 1.3 概率分布

  • 2 R中的函数

1 AFT模型

1.1 符号说明

使用表示生存时间(survival time),表示生存函数(survival function)。

表示的累积分布函数(cumulative distribution function, CDF),表示的概率密度函数(density function)。

表示风险函数(hazard function)。

1.2 模型形式

使用基准生存函数表示一般情况下主体生存率随时间的变化情况,使用表示实际情况下主体的生存函数。

AFT模型假设某些与主体有关的因素会加速或延缓主体生存率到达某一水平的时间。与Cox模型类似,AFT使用下式表示加速因子(acceleration factor):

这样,与就存在如下关系:

举例来说,若,,那么就有,这表明在一般情况下时基准生存率会降低至0.2,而实际上时就达到了这一水平,也就是说失效时间被加速了;反之,若时,失效时间将会被延缓。

对于基准风险函数,因为

那么实际上主体的风险函数

从风险函数的角度可以看出,AFT模型与Cox模型的形式非常相似。

AFT模型与Cox模型的区别在于,它为基准失效时间指定了概率分布形式,从而确定了基准风险函数的形式,因此它是一个参数模型(Cox模型为半参数模型)。

对失效时间进行建模,有

其中,表示在基准生存函数下的失效时间。

两边取对数得

是一个随机变量,服从一定的概率分布形式。对进行标准化得

代入得

上式称为AFT模型的一般形式[1],称作尺度参数(scale parameter)。AFT模型最初也被称作对数位置-尺度模型(Log-Location Scale Model)

1.3 概率分布

因为AFT模型对失效时间进行了对数转换,因此存在两个概率分布,一个是针对对数转换前的失效时间,另一个是针对对数转换后的残差。

下表列举了几种二者概率分布的对应关系:

残差 失效时间
extreme weibull
gaussian lognormal
logistic loglogistic

2 R中的函数

survival工具包中,可以使用survreg()函数拟合AFT模型。例子如下[2]

library(survival)
fit <- survreg(Surv(time, status) ~ age + sex + ph.karno, 
               data = lung, dist = 'weibull')

其中参数dist用于指定的概率分布形式(distribution),详细可参见survival工具包的survreg.distributions的帮助文档:

names(survreg.distributions)
##  [1] "extreme"     "logistic"    "gaussian"    "weibull"     "exponential"
##  [6] "rayleigh"    "loggaussian" "lognormal"   "loglogistic" "t"

查看模型输出结果摘要:

summary(fit)

## Call:
## survreg(formula = Surv(time, status) ~ age + sex + ph.karno, 
##     data = lung, dist = "weibull")
##                Value Std. Error     z       p
## (Intercept)  5.32632    0.66298  8.03 9.4e-16
## age         -0.00891    0.00711 -1.25  0.2100
## sex          0.37019    0.12796  2.89  0.0038
## ph.karno     0.00926    0.00446  2.08  0.0379
## Log(scale)  -0.28085    0.06171 -4.55 5.3e-06
## 
## Scale= 0.755 
## 
## Weibull distribution
## Loglik(model)= -1138.7   Loglik(intercept only)= -1147.5
##  Chisq= 17.59 on 3 degrees of freedom, p= 0.00053 
## Number of Newton-Raphson Iterations: 5 
## n=227 (因为不存在,1个观察量被删除了)

输出结果中的Scale对应模型形式中的。

拟合模型:

head(fitted(fit)) 
## [1] 354.5663 374.0385 416.2499 412.5573 440.6651 244.7723

模型预测:

nd = apply(lung, 2, mean, na.rm = T)
nd = data.frame(t(nd))

## 返回T
predict(fit, newdata = nd, type = "response") 
## 422.1149

## 返回lnT
predict(fit, newdata = nd, type = "link") 
predict(fit, newdata = nd, type = "lp") 
predict(fit, newdata = nd, type = "linear") 
## 6.045278

## 返回每个回归项
predict(fit, newdata = nd, type = "terms") 
##            age           sex ph.karno
## 1 1.756085e-05 -0.0006437289        0

## 返回T的分位数
predict(fit, newdata = nd, type = "quantile",
        p = seq(0,1,0.1)) 
##  [1]   0.00000  77.16338 135.99337 193.79020 254.17593 320.05966 395.14853
##  [8] 485.63274 604.64384 792.42089       Inf

## 返回lnT的分位数
predict(fit, newdata = nd, type = "uquantile",
        p = seq(0,1,0.1)) 
##  [1]     -Inf 4.345925 4.912606 5.266776 5.538027 5.768507 5.979262 6.185453
##  [9] 6.404640 6.675093      Inf

参考资料

[1]

A Review on Accelerated Failure Time Models: http://www.ripublication.com/ijss17/ijssv12n2_15.pdf

[2]

Chapter 4: Accelerated Failure Time models: https://mirrors.tuna.tsinghua.edu.cn/CRAN/web/packages/survival/vignettes/survival.pdf


634d81f47318b769d2ffd4fa2ccafbcc.jpeg
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐