I am fitting AFT models using the command survreg
from the R package survival
. I want to do some further plots of the hazard function but I do not understand what is the parametrization of the AFT model used in this package. The help of this command only indicates:
Description
Fit a parametric survival regression model. These are
location-scale models for an arbitrary transform of the time variable;
the most common cases use a log transformation, leading to accelerated
failure time models.
However, I would like to know if the parametrization in terms of the hazard function is
$$h(t\exp(x^T\beta))\exp(x^T\beta).$$
or
$$h(t\exp(-x^T\beta))\exp(-x^T\beta).$$
but this is not indicated in the manual
https://cran.r-project.org/web/packages/survival/survival.pdf
Best Answer
This might be helpful: https://cran.r-project.org/web/packages/SurvRegCensCov/vignettes/weibull.pdf
Quoting from the first page:
So, in the AFT model as parametrized in the
survreg
function, larger values of $\alpha^\top z$ correspond to an increase in expected survival time (longer survival), whereas in the Cox model as parametrized incoxph
, larger values of $\beta^\top z$ correspond to an increase in the hazard (shorter survival), and when the AFT error follows the Weibull distribution, they are related by $\beta^\top z = -(\alpha^\top z)/ \sigma$To confirm directly that the AFT model in R uses $\alpha^\top z$, compare the linear predictors from a fitted AFT model using
predict.survreg
to the linear predictors calculated 'by hand':We can also check for similarity to the fitted Cox model, but we should only expect them to be similar, not identical, since the Cox model estimates the baseline hazard nonparametrically but the AFT model estimates it parametrically:
Calculating the hazard The general expression for the hazard function at time $x$ is $h(x) = f_T(x)/\Pr(T > x)$, where $f_T(x)$ is the pdf of $T$ at $x$. When $T = \exp\{\mu + \alpha^\top z +\sigma W\}$, then T's distribution is determined by the distribution of $W$. And when $W$ is the extreme value distribution, then $T$ given $z$ is Weibull, and the hazard function is as given above.
The form of the hazard will be different when $W$ is differently distributed. For example, when $W$ is standard normal, then $T$ given $z$ is log-normal. So, $f_T(x) = \frac 1 {x\sigma\sqrt{2\pi}}\ \exp\left(-\frac{\left(\ln x-\mu -\alpha^\top z\right)^2}{2\sigma^2}\right)$ and $\Pr(T > x) = 1 - \Phi\left( \frac{\ln x - \mu - \alpha^\top z} \sigma \right)$, and $$h(x|z) = \dfrac{\frac 1 {x\sigma\sqrt{2\pi}}\ \exp\left(-\frac{\left(\ln x-\mu -\alpha^\top z\right)^2}{2\sigma^2}\right)}{1 - \Phi\left( \frac{\ln x - \mu - \alpha^\top z} \sigma \right)}$$
For other distributions of $W$, the form of the hazard will be different yet. As you may know, the choice of Weibull $T$ (equivalently, Extreme Value $W$) is the only choice that is both an AFT model as well as a proportional hazards model.
I'm not aware of functionality in R to automatically calculate and extract the hazard curves for all observations. So you would likely need to write up a function yourself.