Accelerated Failure-Time Models › Formula

Michael BrenndoerferOctober 26, 202611 min read
Machine Learning from ScratchAll chapters
Part 6 of 15Survival Analysis
Chapter 51Accelerated Failure-Time Models › Formula
Reading section 4 of 10 · Formula · 11 minSection 4 of 10 · 11 min

Section 4 of 10 · 11 min read

Accelerated Failure-Time Models › FormulaSection view · Sections in this chapter4 / 10 ↓
Reading tools Definitions, links & notes

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Notes & comments

Positive event times allow us to model log⁡T\log T. The basic AFT model then assumes a linear location on this log scale and a common error distribution and scale across covariate profiles. The log transformation does not guarantee symmetry: normal errors are symmetric, while the minimum Gumbel errors used for Weibull lifetimes are not. A one-unit increase in a linearly entered covariate changes log time by its coefficient, giving a multiplicative factor on the time scale. Doubling a raw covariate is not generally a fixed one-unit change.

We begin with notation. For subject ii, let Ti>0T_i>0 be the true event time, let CiC_i be the censoring time, and let

Yi=min⁡(Ti,Ci)Y_i = \min(T_i, C_i)

be the observed time. Define the event indicator

δi={1,if Ti≤Ci,0,if Ti>Ci.\delta_i = \begin{cases} 1, & \text{if } T_i \leq C_i, \\ 0, & \text{if } T_i > C_i. \end{cases}

Thus δi=1\delta_i=1 means we observed the event, and δi=0\delta_i=0 means the observation was right-censored. Let xi=(1,xi1,…,xip)⊤\mathbf{x}_i=(1,x_{i1},\ldots,x_{ip})^\top include an intercept and pp covariates, and let β=(β0,β1,…,βp)⊤\boldsymbol{\beta}=(\beta_0,\beta_1,\ldots,\beta_p)^\top be the corresponding coefficient vector.

What we ultimately want is the conditional distribution of TiT_i given xi\mathbf{x}_i, but the observed data give only partial information: for events we see TiT_i, for censored subjects we only know that Ti>yiT_i > y_i. The rest of this section does three things in order. We express the covariate effect as a location shift on the log scale and quantify it as a time ratio. We assemble a likelihood that handles events and censored observations in the same expression. We examine the two distributional choices that determine the shape of the resulting survival curves.

Log-time regression and acceleration factors

The AFT model writes the log event time as

log⁡Ti=β0+β1xi1+⋯+βpxip+σWi,\log T_i = \beta_0 + \beta_1 x_{i1} + \cdots + \beta_p x_{ip} + \sigma W_i,

where WiW_i is a standardized error term with a chosen distribution, and σ>0\sigma>0 is a scale parameter. In matrix notation,

log⁡Ti=xi⊤β+σWi.\log T_i = \mathbf{x}_i^\top \boldsymbol{\beta} + \sigma W_i.

Equivalently,

Ti=exp⁡(xi⊤β)exp⁡(σWi).T_i = \exp(\mathbf{x}_i^\top \boldsymbol{\beta}) \exp(\sigma W_i).

The two factors on the right have clearly separated roles. The first, exp⁡(xi⊤β)\exp(\mathbf{x}_i^\top \boldsymbol{\beta}), depends only on covariates and shifts the entire distribution of event times. The second, exp⁡(σWi)\exp(\sigma W_i), is subject-level noise that has the same distribution for every subject. This separation is why AFT coefficients are interpretable: all of the covariate effect is carried by a single location shift on the log scale, and everything else is the shape of the error distribution.

To see what the shift means on the time scale, compare two subjects with covariate vectors that differ only in the jj-th component by one unit, and imagine that the individual noise WiW_i is identical for both. Then

Ti(xj+1)Ti(xj)=exp⁡(xi⊤β+βj)exp⁡(σWi)exp⁡(xi⊤β)exp⁡(σWi)=exp⁡(βj).\frac{T_i(x_j+1)}{T_i(x_j)} = \frac{\exp(\mathbf{x}_i^\top \boldsymbol{\beta}+\beta_j)\exp(\sigma W_i)} {\exp(\mathbf{x}_i^\top \boldsymbol{\beta})\exp(\sigma W_i)} = \exp(\beta_j).

This ratio is the time ratio, also called the acceleration factor. If βj=0.2\beta_j=0.2, then exp⁡(0.2)=1.2214\exp(0.2)=1.2214, so the event time is multiplied by about 1.22, or prolonged by 22.1 percent. If βj=−0.2\beta_j=-0.2, then exp⁡(−0.2)=0.8187\exp(-0.2)=0.8187, so the event time is multiplied by about 0.82, or shortened by 18.1 percent. The same factor applies to every quantile of the event-time distribution, because the pp-th quantile of TiT_i depends on covariates only through the common factor exp⁡(xi⊤β)\exp(\mathbf{x}_i^\top \boldsymbol{\beta}). That is the precise sense in which a covariate "stretches the clock."

For likelihood work it is more convenient to translate the model into a survival function. If SW(w)=P(W>w)S_W(w)=P(W>w) is the survival function of the standardized error, then

ST(t∣x)=P(T>t∣x)=P(W>log⁡t−x⊤βσ)=SW(log⁡t−x⊤βσ).S_T(t\mid \mathbf{x}) = P(T>t\mid \mathbf{x}) = P\left(W>\frac{\log t-\mathbf{x}^\top \boldsymbol{\beta}}{\sigma}\right) = S_W\left(\frac{\log t-\mathbf{x}^\top \boldsymbol{\beta}}{\sigma}\right).

Once SWS_W, β\boldsymbol{\beta}, and σ\sigma are fixed, the survival curve can be evaluated from the assumed error survival function. Cox regression can also produce survival curves after baseline estimation; the difference here is the explicit parametric event-time distribution. Different choices of SWS_W give different tail shapes and different hazard patterns, which is the source of the modeling decision discussed later.

Censored likelihood contributions

For a censored subject, the observed record does not reveal TiT_i; it gives a lower bound on that time. Evaluating the event density at the censoring time would invent an observed event. The right-censoring decomposition resolves this by assigning the two kinds of observation two structurally different likelihood pieces:

  • If subject ii has an observed event at yiy_i, we have observed the value of TiT_i, so its contribution is the density fT(yi∣xi)f_T(y_i\mid \mathbf{x}_i).
  • If subject ii is censored at yiy_i, the only information available is that Ti>yiT_i>y_i, so its contribution is the probability of that event, the survival function ST(yi∣xi)S_T(y_i\mid \mathbf{x}_i).

Assume independent subjects, conditionally independent censoring, and censoring-law parameters distinct from the event-time parameters. After removing factors that do not depend on the fitted parameters, the likelihood is the product:

L(β,σ)=∏i=1nfT(yi∣xi)δiST(yi∣xi)1−δi.L(\boldsymbol{\beta},\sigma) = \prod_{i=1}^{n} f_T(y_i\mid \mathbf{x}_i)^{\delta_i} S_T(y_i\mid \mathbf{x}_i)^{1-\delta_i}.

Taking logarithms turns the product into a sum:

ℓ(β,σ)=∑i=1n[δilog⁡fT(yi∣xi)+(1−δi)log⁡ST(yi∣xi)].\ell(\boldsymbol{\beta},\sigma) = \sum_{i=1}^{n} \left[ \delta_i \log f_T(y_i\mid \mathbf{x}_i) + (1-\delta_i)\log S_T(y_i\mid \mathbf{x}_i) \right].

To express each piece in terms of the standardized error, standardize each observation:

wi=log⁡yi−xi⊤βσ.w_i = \frac{\log y_i-\mathbf{x}_i^\top \boldsymbol{\beta}}{\sigma}.

Because T=exp⁡(x⊤β+σW)T=\exp(\mathbf{x}^\top \boldsymbol{\beta}+\sigma W), the transformation from WW to TT has Jacobian

dtdw=σexp⁡(x⊤β+σw)=σt.\frac{dt}{dw} = \sigma \exp(\mathbf{x}^\top \boldsymbol{\beta}+\sigma w) = \sigma t.

Therefore the density of TT is

fT(t∣x)=fW(w)σt,f_T(t\mid \mathbf{x}) = \frac{f_W(w)}{\sigma t},

where fWf_W is the density of the standardized error. Taking logs gives

log⁡fT(t∣x)=−log⁡t−log⁡σ+log⁡fW(w).\log f_T(t\mid \mathbf{x}) = -\log t-\log \sigma+\log f_W(w).

The Jacobian contributes −log⁡t−log⁡σ-\log t-\log\sigma to an event log density. For fixed observed times, the −log⁡t-\log t term does not depend on the fitted parameters: omitting that term alone changes absolute time-scale likelihood values, but not the maximizer. It also cancels from AIC differences when both models omit the same term on the same event records. The −log⁡σ-\log\sigma term does depend on a fitted parameter and must remain in the objective. Retaining the complete density avoids mismatched scoring conventions. The survival function transforms without a Jacobian, because it is a probability:

ST(t∣x)=SW(w).S_T(t\mid \mathbf{x})=S_W(w).

Substituting these expressions into the log-likelihood, we obtain the general AFT censored log-likelihood:

ℓ(β,σ)=∑i=1n[δi(−log⁡yi−log⁡σ+log⁡fW(wi))+(1−δi)log⁡SW(wi)].\ell(\boldsymbol{\beta},\sigma) = \sum_{i=1}^{n} \left[ \delta_i\left(-\log y_i-\log \sigma+\log f_W(w_i)\right) + (1-\delta_i)\log S_W(w_i) \right].

Two features of this expression deserve emphasis. First, the two halves of the summand are structurally different: an event contributes a density with its Jacobian, while a censored observation contributes a survival probability. Each subject activates exactly one of the two. Second, if no observation is censored, the second term vanishes. The remaining likelihood gives the same parameter estimates as ordinary log-location-scale regression on log⁡Ti\log T_i, differing from its log-time likelihood by the parameter-free sum −∑ilog⁡yi-\sum_i\log y_i. Every parametric AFT model, including Weibull, log-normal, and log-logistic, is expressed simply by plugging in the corresponding fWf_W and SWS_W in this formula.

Weibull and log-normal event-time models

The general likelihood is now in hand; the remaining decision is what to plug in for fWf_W and SWS_W. We compare two error distributions:

  • The standard normal error is symmetric and produces a log-normal distribution for TT. Its hazard can rise and then fall, which allows a non-monotone risk pattern.
  • The minimum Gumbel error is less familiar but produces the Weibull distribution for TT, which has a special algebraic connection to proportional hazards. That connection is what allows Weibull AFT coefficients to be translated into hazard ratios.

The distributions can give similar fits in part of the observed range while implying different tails. Their agreement in the middle is not guaranteed.

The survival curve comparison can be read alongside the corresponding hazard functions. Holding log-time location and scale fixed, the log-normal hazard is not forced to be monotone, while the Weibull hazard is monotone in this parameterization. The following curves use the same location and scale for both families, so the difference in shape comes from the error distribution rather than from a changed regression coefficient.

PythonIn [3]
CollapseExpand
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats

# Fixed illustrative values, not estimates. No random sampling or fitting is used.
t_hazard = np.linspace(0.25, 8.0, 400)
eta_hazard = 1.0
sigma_hazard = 0.6

z_hazard = (np.log(t_hazard) - eta_hazard) / sigma_hazard
hazard_lognormal = stats.norm.pdf(z_hazard) / (
    sigma_hazard * t_hazard * stats.norm.sf(z_hazard)
)
hazard_weibull = (1.0 / (sigma_hazard * t_hazard)) * np.exp(z_hazard)
hazard_ylim = (0.0, 1.15 * max(hazard_lognormal.max(), hazard_weibull.max()))
VisualizationOut [4]
CollapseExpand
Log-normal hazard rises then falls while Weibull hazard increases monotonically.
Log-normal and Weibull hazard functions at log-time location 1 and scale 0.6. The Weibull hazard increases monotonically because its shape parameter is 1/0.6, while the log-normal hazard rises and then falls. Equal location and scale therefore do not imply equal risk patterns.

For the log-normal AFT model, W∼N(0,1)W\sim N(0,1). Then

ST(t∣x)=1−Φ(log⁡t−x⊤βσ)=Φ(x⊤β−log⁡tσ),S_T(t\mid \mathbf{x}) = 1-\Phi\left(\frac{\log t-\mathbf{x}^\top \boldsymbol{\beta}}{\sigma}\right) = \Phi\left(\frac{\mathbf{x}^\top \boldsymbol{\beta}-\log t}{\sigma}\right),

where:

  • Φ\Phi: the standard normal cumulative distribution function
  • tt: the event time
  • x⊤β\mathbf{x}^\top \boldsymbol{\beta}: the log-time location for the covariate profile
  • σ\sigma: the log-time scale parameter

The density is

fT(t∣x)=1tσϕ(log⁡t−x⊤βσ),f_T(t\mid \mathbf{x}) = \frac{1}{t\sigma}\phi\left(\frac{\log t-\mathbf{x}^\top \boldsymbol{\beta}}{\sigma}\right),

where ϕ\phi is the standard normal density. The hazard is the ratio

hT(t∣x)=fT(t∣x)ST(t∣x)=ϕ(w)σt Φ(−w).h_T(t\mid \mathbf{x}) = \frac{f_T(t\mid \mathbf{x})}{S_T(t\mid \mathbf{x})} = \frac{\phi(w)}{\sigma t\,\Phi(-w)}.

Here w=(log⁡t−x⊤β)/σw=(\log t-\mathbf{x}^\top\boldsymbol{\beta})/\sigma. The log-normal hazard can rise and later fall; it tends to zero both as t↓0t\downarrow0 and as t→∞t\to\infty. This is different from a Weibull hazard, whose direction is controlled by one shape parameter.

For the Weibull AFT model, WW follows the standard minimum Gumbel distribution, whose survival function is

SW(w)=exp⁡(−ew),S_W(w)=\exp(-e^w),

where:

  • ww: the standardized log-time value (log⁡t−x⊤β)/σ(\log t-\mathbf{x}^\top \boldsymbol{\beta})/\sigma
  • ewe^w: the exponential of ww, which is always positive
  • exp⁡(−ew)\exp(-e^w): the Gumbel survival probability, decreasing from 1 toward 0 as ww increases

Substituting w=(log⁡t−x⊤β)/σw=(\log t-\mathbf{x}^\top \boldsymbol{\beta})/\sigma gives

ST(t∣x)=exp⁡[−exp⁡(log⁡t−x⊤βσ)].S_T(t\mid \mathbf{x}) = \exp\left[-\exp\left(\frac{\log t-\mathbf{x}^\top \boldsymbol{\beta}}{\sigma}\right)\right].

If we set the shape parameter k=1/σk=1/\sigma and the scale parameter λ(x)=exp⁡(x⊤β)\lambda(\mathbf{x})=\exp(\mathbf{x}^\top \boldsymbol{\beta}), this becomes the usual Weibull survival function

ST(t∣x)=exp⁡[−(tλ(x))k].S_T(t\mid \mathbf{x}) = \exp\left[-\left(\frac{t}{\lambda(\mathbf{x})}\right)^k\right].

The density is

fT(t∣x)=kλ(x)(tλ(x))k−1exp⁡[−(tλ(x))k].f_T(t\mid \mathbf{x}) = \frac{k}{\lambda(\mathbf{x})} \left(\frac{t}{\lambda(\mathbf{x})}\right)^{k-1} \exp\left[-\left(\frac{t}{\lambda(\mathbf{x})}\right)^k\right].

To derive the hazard, we use the definition hT(t)=fT(t)/ST(t)h_T(t)=f_T(t)/S_T(t). Differentiating the survival function with the chain rule,

ddtST(t∣x)=−ST(t∣x)exp⁡(log⁡t−x⊤βσ)1σt.\frac{d}{dt}S_T(t\mid \mathbf{x}) = -S_T(t\mid \mathbf{x}) \exp\left(\frac{\log t-\mathbf{x}^\top \boldsymbol{\beta}}{\sigma}\right) \frac{1}{\sigma t}.

Since fT(t)=−dST(t)/dtf_T(t)=-dS_T(t)/dt, dividing by ST(t)S_T(t) gives

hT(t∣x)=1σtexp⁡(log⁡t−x⊤βσ).h_T(t\mid \mathbf{x}) = \frac{1}{\sigma t} \exp\left(\frac{\log t-\mathbf{x}^\top \boldsymbol{\beta}}{\sigma}\right).

This factorization is why the Gumbel error is useful here. Write the hazard as

hT(t∣x)=[1σtexp⁡(log⁡t−β0σ)]exp⁡(−∑j=1pxjβjσ).h_T(t\mid \mathbf{x}) = \left[ \frac{1}{\sigma t} \exp\left(\frac{\log t-\beta_0}{\sigma}\right) \right] \exp\left(-\frac{\sum_{j=1}^{p}x_j\beta_j}{\sigma}\right).

The sum in the second factor uses only the pp slope terms, excluding the intercept. The term in brackets depends only on time and the baseline parameters, and the remaining factor is constant over time. That is the proportional hazards structure, with hazard ratio

HRj=exp⁡(−βjσ)\text{HR}_j=\exp\left(-\frac{\beta_j}{\sigma}\right)

for a one-unit increase in covariate jj. The sign flips relative to the AFT coefficient because a positive βj\beta_j lengthens event times and therefore lowers the hazard. Among the two families studied here, the Weibull model has this proportional-hazards conversion; a log-normal AFT model does not generally have proportional hazards, because its hazard ratio changes with time. That distinction is the practical meaning of choosing one error distribution over the other.

Mathematical Properties

The acceleration interpretation can be made exact through the quantile function. If qpq_p is the pp-th quantile of WW, then the pp-th quantile of TT given covariates is

tp(x)=exp⁡(x⊤β+σqp).t_p(\mathbf{x}) = \exp\left(\mathbf{x}^\top \boldsymbol{\beta}+\sigma q_p\right).

For a one-unit change in xjx_j, the ratio of quantiles is exp⁡(βj)\exp(\beta_j), independent of pp. This is the constant time-ratio property, and it is what justifies calling exp⁡(βj)\exp(\beta_j) an acceleration factor rather than just a coefficient on the log scale.

The median depends on which WW we choose. For the log-normal model, the median is exp⁡(x⊤β)\exp(\mathbf{x}^\top \boldsymbol{\beta}) because the median of a standard normal is zero. For the Weibull model, the median is

exp⁡(x⊤β+σlog⁡(log⁡2)),\exp\left(\mathbf{x}^\top \boldsymbol{\beta}+\sigma \log(\log 2)\right),

because the minimum Gumbel median is log⁡(log⁡2)≈−0.3665\log(\log2)\approx-0.3665. Solving exp⁡(−ew)=1/2\exp(-e^w)=1/2 gives ew=log⁡2e^w=\log2, so the median shift is negative when multiplied by positive σ\sigma. The two models can therefore share the same x⊤β\mathbf{x}^\top \boldsymbol{\beta} and σ\sigma while having different medians and different tails.

Finally, fitting requires numerical care. The log-likelihood is not guaranteed to be globally concave in all parameters. For example, joint concavity can fail in the log-normal location and log-scale parameterization even without censoring. In practice we optimize numerically, parameterize σ\sigma as exp⁡(γ)\exp(\gamma) so that it stays positive, and use good starting values or multiple starts. Each parameterization needs its own existence and convergence checks; multiple starts do not establish a global optimum.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy