Parametric and Frailty Survival Models

Bongani Ncube(3002164)

2026-09-07

webuse schvote, clear

probit priv years ptax inc
## file https://www.stata-press.com/data/r19/schvote.dta not found
## r(601);
## 
## r(601);

Setup


wei_shape <- seq(.25, 3, .25)
times <- seq(1, 10, 1)
rate <- seq(1, 5, 1)
hazfun <- function(FUN, param_vals, times){
  # Compute hazard for all possible combinations of parameters and times
  values <- do.call("mapply", c(list(FUN = FUN),
                                as.list(expand.grid(param_vals)),
                                list(MoreArgs = list(x = times))))
  x <- data.table(expand.grid(c(param_vals, list(time = times))),
                  value = c(t(values)))
  
  # Create factor variables and intuitive names for plotting
  param_names <- names(param_vals)
  x[[param_names[1]]] <- factor(x[[param_names[1]]],
                                levels = unique(x[[param_names[1]]]))
  if (length(param_vals) > 1){
    for (j in 2:length(param_vals)){
      ordered_vals <- unique(x[[param_names[j]]])
      x[[param_names[j]]] <- paste0(param_names[j], " = ", x[[param_names[j]]])
      factor_levels <- paste0(param_names[j], " = ", ordered_vals)
      x[[param_names[j]]] <- factor(x[[param_names[j]]],
                                    levels = factor_levels)
    }
  }
  
  # Return
  return(x)
}

Parametric Proportional Hazard Models

The Cox regression model is often used in survival data analysis as it does not require a specific probability distribution assumption for the survival times. However, assuming a particular probability distribution can improve the precision of inferences, such as estimates of relative hazards and median survival times. Parametric models assume a specific probability distribution for the survival times.

NoteDefinition

A parametric survival model is one in which survival time (the outcome) is assumed to follow a known distribution. Examples of distributions that are commonly used for survival time are:

the Weibull, the exponential (a special case of the Weibull), the log-logistic, the lognormal, and the generalized gamma, which are supported by SAS, Stata, and R software.

NoteA closer look on the Cox model
  • The Cox model does not make any assumption about the shape of the hazard function.
  • Instead, the baseline hazard is allowed to vary freely.
  • The Cox model only estimates hazard ratios relative to the baseline hazard.
  • Since the baseline hazard is not estimated in the Cox model, it is said to be semi-parametric.

Note: given a fitted Cox model, we can estimate the non-parametric baseline cumulative hazard and then smooth to estimate the hazard.

  • However, the Cox model does not estimate the baseline hazard, \(h_0(t)\). It only estimates the regression coefficients, \(\beta\)
  • We are usually more interested in studying how hazard varies as a function of explanatory variables (the relative hazard) rather than the shape of the underlying hazard function (the absolute hazard).

Formulation of the Cox

\[h(t|X)=e^{\beta_0+\beta_1X_1+...+\beta_kX_k}\]

\[log[h(t|X)]=\beta_0+\beta_1X_1+...+\beta_kX_k\]

This formulation is identical to the Poisson regression model. That is,

\[log[\frac{no.events}{person-times}]=\beta_0+\beta_1X_1+...+\beta_kX_k\]

The remedy is to replace \(\beta_0\), the ‘intercept’ in the linear predictor, by an arbitrary function of time — say \(log(h_0(t))\); thus, the resulting equation is

\[log[h(t|X)]= log[h_0(t)]+\beta_1X_1+...+\beta_kX_k\]

Comparison of Cox regression to Poisson regression for the analysis of cohort studies.

  • The methods are very similar; the basic formulation of both models is: \[log(rate) = X \beta\]
  • In both cases, the β parameters are interpreted as log rate ratios.
  • Both models are multiplicative (i.e. both assume proportional hazards).
  • In Poisson regression, follow-up time is classified into bands and a separate rate parameter is estimated for each band (or smoothed!), thereby allowing for the possibility that the rate is changing with time.
  • It is assumed that the rate is constant within each band, so if the rate is changing rapidly with time we may have to choose very narrow bands.
  • In Cox regression, we essentially choose bands of infinitesimal width; each band is so narrow that it includes only a single event.

Weibull PH model

The hazard and the survival function of the Weibull distribution are given by, \(h(t) = \gamma \lambda t^{\gamma-1}\) and \(S(t) = e^{-\lambda t^\gamma}\) respectively. The hazard function of a patient with covariates \(X_1,X_2,X_3,\cdots X_p\) is given by \[\begin{equation} h(t|X_i) =\gamma \lambda t^{\gamma-1} \exp(\beta_1 X_{i1} + \cdots + \beta_p X_{ip})=\gamma \lambda t^{\gamma-1}\text{exp}^{(\beta^{T} X)} \end{equation}\] making use of equation . The corresponding survival function is given by: \[\begin{equation} S_i(t)=\text{exp}\{\exp(\beta^{T} x_i)\lambda t^{\gamma}\} \end{equation}\] The model is fitted using the likelihood function of the \(n\) observations and maximizing this function with respect to unknown parameters \((\beta_1,\beta_2,\beta_3,\cdots,\beta_p),\lambda\) and \(\gamma\) where the likelihood function for the hazard and survivor function is given by : \[\begin{equation} L(\alpha,\mu,\sigma)=\prod_{i=1}^{n}\{h_i(t_i)\}^{\sigma_i}S_i(t_i) \end{equation}\] Taking logarithms in equation we get \[\begin{equation} \log L(\alpha,\mu,\sigma)=\sum^{n}_{i=1}\{\sigma_i \log h_i(t_i)+\log S_i(t_i)\} \end{equation}\] Now substituting and simplyfying we get \[\begin{equation} \log L(\alpha,\mu,\sigma)=\sum^n_{i=1}[\sigma_i\{\beta` x_i+\log(\lambda\gamma)+\gamma\log (t_i)\} -\lambda\text{exp}(\beta` x_i)t^{\gamma} \end{equation}\]

Weibull distribution (PH)

flexsurv provides an alternative PH parameterization of the Weibull model with the same shape parameter \(a\) and a scale parameter \(m = b^{-a}\) where \(b\) is the scale parameter in the AFT model.

The hazard is again decreasing for \(a < 1\), constant for \(a = 1\), and increasing for \(a > 1\). Note that for \(a = 1\), the PH Weibull distribution is equivalent to an exponential distribution with rate parameter \(m\).

haz_weiPH <- hazfun(flexsurv::hweibullPH, 
                  list(scale = seq(2, 5, .5),
                       shape = wei_shape),
                  times = times)
ggplot(haz_weiPH, aes(x = time, y = value, col = scale)) +
  geom_line() + facet_wrap(~shape, scales = "free_y") +
  xlab("Time") + ylab("Hazard") 

The Exponential PH model

The survival function and hazard function are given by \(S(t) = e^{-\lambda t}\) and \(h(t)=\lambda\) respectively. Evaluating equation ,the hazard function for the exponential PH model of a particular patient is given by
\[\begin{equation} h(t|X_i) =\lambda \text{exp}(\beta_1 X_{i1} + \cdots + \beta_p X_{ip})=\lambda \text{exp}^{(\beta^{T} X)} \end{equation}\]

Exponential distribution

on The exponential distribution is parameterized by a single rate parameter and only supports a hazard that is constant over time. The hazard is simply equal to the rate parameter.

times <- seq(1, 10, 1)
rate <- seq(1, 5, 1)
haz_exp <- hazfun(flexsurv::hexp, 
                  list(rate = rate),
                  times = times)
ggplot(haz_exp, aes(x = time, y = value, col = rate)) +
  geom_line() + xlab("Time") + ylab("Hazard") +
  scale_y_continuous(breaks = rate) 

Gompertz distribution

The Gompertz distribution is parameterized by a shape parameter \(a\) and rate parameter \(b\). The hazard is increasing for \(a > 0\), constant for \(a = 0\), and decreasing for \(a < 0\). When \(a = 0\), the Gompertz distribution is equivalent to an exponential distribution with rate parameter \(b\).

haz_gomp <- hazfun(flexsurv::hgompertz, 
                  list(rate = seq(.5, 3, .5),
                       shape = seq(-2, 2, .5)),
                  times = times)
ggplot(haz_gomp, aes(x = time, y = value, col = rate)) +
  geom_line() + facet_wrap(~shape, scales = "free_y") +
  xlab("Time") + ylab("Hazard") 

Gamma distribution

The gamma distribution is parameterized by a shape parameter \(a\) and a rate parameter \(b\). Like the Weibull distribution, the hazard is decreasing for \(a < 1\), constant for \(a = 1\), and increasing for \(a >1\). In the case where \(a = 1\), the gamma distribution is an exponential distribution with rate parameter \(b\).

haz_gam <- hazfun(flexsurv::hgamma, 
                  list(rate = seq(.5, 3, .5),
                       shape = c(1e-5, .5, 1, seq(2, 6))),
                  times = times)
ggplot(haz_gam, aes(x = time, y = value, col = rate)) +
  geom_line() + facet_wrap(~shape, scales = "free_y") +
  xlab("Time") + ylab("Hazard") 

Lognormal distribution

The lognormal distribution is parameterized by the mean \(\mu\) and standard deviation \(\sigma\) of survival time on the log scale. The lognormal hazard is either monotonically decreasing or arc-shaped. Note that the shape of the hazard depends on the values of both \(\mu\) and \(\sigma\).

haz_lnorm <- hazfun(flexsurv::hlnorm, 
                    list(meanlog = seq(0, 4, .5),
                         sdlog = seq(.5, 3, .5)),
                  times = seq(0, 20, .1))
ggplot(haz_lnorm, aes(x = time, y = value, col = meanlog)) +
  geom_line() + facet_wrap(~sdlog, scales = "free_y") +
  xlab("Time") + ylab("Hazard") 

Log-logistic distribution

The log-logistic distribution is parameterized by a shape parameter \(a\) and a scale parameter \(b\). When \(a > 1\), the hazard function is arc-shaped whereas when \(a \leq 1\), the hazard function is decreasing monotonically.

haz_llogis <- hazfun(flexsurv::hllogis, 
                    list(scale = seq(.5, 4, .5),
                         shape = seq(.5, 3, .5)),
                  times = seq(0, 20, 1))
ggplot(haz_llogis, aes(x = time, y = value, col = scale)) +
  geom_line() + facet_wrap(~shape, scales = "free_y") +
  xlab("Time") + ylab("Hazard") 

Accelerated Failure Time Models

These models encompass a broader range of survival time distributions and may be more useful in situations where the proportional hazards assumption is not valid. Models based on this general family can prove to be fruitful. Under the accelerated failure time (AFT) models, we measure the direct impact of the explanatory variables on the survival time, instead of the hazard as we do in proportional hazards models. This approach facilitates the interpretation of results since the parameters quantify the impact of the corresponding covariate on the mean survival time. According to the general AFT model, the hazard function of the \(i\)-th patient at time \(t\), \(h_i(t)\), is such that: \[\begin{equation} h_i(t)=e^{-\phi_i}h_0(t/e^{-\phi_i}) \end{equation}\] The acceleration factor\(\phi_i\) is given according to the formula \[\phi_i =\text{exp}(\alpha_1x_{1i}+\alpha_2x_{2i}+ \cdots +\alpha_px_{pi}\] where \(x_{ji}\) is the value of the \(jth\) explanatory variable,\(X_j\),(\(j=1,2,3,\cdots,p\)),for the \(ith\) individual,(\(i=1,2,3,\cdots,n\)). For a group of patients with with covariates \((X_1,X_2,\cdots,X_p)\),The survival function for the \(ith\) individual is given mathematically as \[\begin{equation} S_i(t|x) = S_0(t/\phi_i) \end{equation}\] Where \(S_0(t)\) is the baseline survival function and \(\phi\) is an accelerated factor implying a ratio of survival times corresponding to any fixed value of \(S(t)\). Parametric accelerated failure time models are unified by the adoption of a log-linear representation of the model and this form of the model is adopted by most computer software packages for accelerated failure time modelling. The log-linear model for the random variable \(T_i\) , associated with the lifetime of the \(ith\) individual in a survival study is given by

\[\begin{equation} \log T_i=\mu +\alpha_1x_{1i}+\alpha_2x_{2i}+ \cdots +\alpha_px_{pi}+\sigma\epsilon_i \end{equation}\] In this model, \(\alpha = (\alpha_1, \alpha_2, \ldots, \alpha_p)\) are the unknown coefficients of the explanatory variables \(X_1, X_2, \ldots, X_p\), with values \((x_{1i}, x_{2i}, \ldots, x_{pi})\) for the \(i\)-th individual. \(\mu\) and \(\sigma\) are two additional parameters known as the intercept and scale parameter, respectively. The quantity \(\sigma_i\) is a random variable used to model the deviation of the values of \(\log(T_i)\) from the linear component of the model. \(\sigma\) is a scale parameter and an error term typically expressed using a normal, logistic, or standard Gumbel distribution. The specific case of a standard Gumbel distribution for \(\sigma\) implies a conditional (on \(\beta\) and \(\sigma\)) Weibull survival model for \(T\) with shape parameter \(\alpha = 1/\alpha\) and scale parameter \(\lambda(\beta, \sigma) = \exp(-x^T\beta/\sigma)\) (Christensen et al., 2011). The \(\alpha\)-parameters reflect the impact of each explanatory variable on the survival times; positive values indicate that the survival time increases with increasing values of the explanatory variable, and vice versa. It can be shown that the survivor function for the \(i\)-th individual in an accelerated failure time model is given by: \[\begin{equation} S_i(t)=S_0\{t/\text{exp}(\alpha'x_i)\} \end{equation}\] The corresponding hazard function is also given by \[\begin{equation} h_i(t)=\text{exp}(\alpha'x_i)h_0\{t/\text{exp}(\alpha'x_i)\} \end{equation}\]

Weibull AFT model

Assuming that the survival times follow a Weibull distribution with scale parameter \(\lambda\) and shape parameter \(\gamma\) so that the baseline hazard as given by \(h(t) = \gamma \lambda t^{\gamma-1}\),the hazard function for the \(ith\) individual is then,given by \[\begin{equation} h_i(t)=e^{-\phi_i}\lambda\gamma(e^{\phi_it})^{\gamma-1}=(e^{-\phi_i})^{\gamma}\lambda\gamma t^{\gamma-1} \end{equation}\] Implying that the survival time of the individual has a weibull distribution with scale parameter \(\lambda e^{-\gamma\phi_i}\) and shape parameter \(\gamma\). This property of the weibull distribution is called accelerated failure time property. The survivor and hazard function under the log-linear is given by

\[\begin{equation} S_i(t)=\text{exp}\left\{-\text{exp}\left(\frac{\log t -\mu -\phi_i}{\sigma}\right)\right\} \end{equation}\] and \[\begin{equation} h_i(t)=\frac{1}{\sigma t}\text{exp}\left(\frac{\log t -\mu -\phi_i}{\sigma}\right) \end{equation}\]

Weibull distribution (AFT)

The Weibull distribution can be parameterized as both an accelerated failure time (AFT) model or as a proportional hazards (PH) model. The parameterization in the base stats package is an AFT model.

The hazard is decreasing for shape parameter \(a < 1\) and increasing for \(a > 1\). For \(a = 1\), the Weibull distribution is equivalent to an exponential distribution with rate parameter \(1/b\) where \(b\) is the scale parameter.

wei_shape <- seq(.25, 3, .25)
haz_wei <- hazfun(flexsurv::hweibull, 
                  list(scale = seq(2, 5, .5),
                       shape = wei_shape),
                  times = times)
ggplot(haz_wei, aes(x = time, y = value, col = scale)) +
  geom_line() + facet_wrap(~shape, scales = "free_y") +
  xlab("Time") + ylab("Hazard") 

log-logistic AFT model

Suppose the suvival times follow a log-logistic distribution with a baseline hazard of \(h(t)=\frac{\exp^{\theta}kt^{k-1}}{1+\text{exp}^{\theta}t^k}\) ,it can be shown that the hazard function for the \(ith\) individual is then given by

\[\begin{equation} h_i(t)=\frac{e^{\theta-k\phi_i}kt^{k-1}}{1+e^{\theta-k\phi_i}t^k} \end{equation}\] It then follows that the survival time for the ith individual also has a log-logistic distribution with parameters \(\theta- k\phi_i\) and \(k\). The log-linear form of the accelerated failure time model provides a representation of the log-logistic such that the survivor function of \(T_i\) is \[\begin{equation} S_i(t)=\left\{1+\text{exp}\left(\frac{\log t -\mu-\phi_i}{\sigma}\right)\right\}^{-1} \end{equation}\] where \(\phi_i=\alpha_1x_{1i}+\alpha_2x_{2i}+\cdots +\alpha_px_{pi}\) and corresponding hazard function given by \[\begin{equation} h_i(t)=\frac{1}{\sigma t}\left\{1+\text{exp}\left[-\left(\frac{\log t -\mu-\phi_i}{\sigma}\right)\right]\right\}^{-1} \end{equation}\]

Lognormal AFT model

The baseline survival function for a model that is assumed to have a logormal distribution is given below. survivor function is given by \[S_0(t)=1-\Phi\left(\frac{\log t- \mu}{\sigma}\right)\] The corresponding survivor function for the \(ith\) individual under the accelerated failure time model,is then \[S_i(t)=S_0(e^{-\phi_i}t)\] where \(\phi_i=\alpha_1x_{1i}+\alpha_2x_{2i}+\cdots +\alpha_px_{pi}\) is a linear combination of the values of \(p\) explanatory variables for the \(ith\) individual. This implies that the corresponding survivor function is given by \[\begin{equation} S_i(t) = 1- \Phi\left(\frac{\log t -\phi_i-\mu}{\sigma}\right) \end{equation}\] this is the survival function for an individual whose survival times have a lognormal distribution with parameters \(\mu +\phi_i\) and \(\sigma\). Implying that this model has the accelerated failure time property.

Summary

  • the exponential distribution only supports a constant hazard;
  • the Weibull, Gompertz, and gamma distributions support monotonically increasing and decreasing hazards;
  • the log-logistic and lognormal distributions support arc-shaped and monotonically decreasing hazards; and
  • the generalized gamma distribution supports an arc-shaped, bathtub-shaped, monotonically increasing, and monotonically decreasing hazards.
PDF CDF Hazard Parameters Hazard shape
Exponential \(\lambda e^{-\lambda t}\) \(1 - e^{-\lambda t}\) \(\lambda\) \(\color{red}{\text{rate}} = \lambda \gt 0\) Constant
Weibull (AFT) \(\frac{a}{b}\left(\frac{t}{b}\right)^{a-1}e^{-(t/b)^a}\) \(1 - e^{-(t/b)^a}\) \(\frac{a}{b}\left(\frac{t}{b}\right)^{a-1}\) \(\text{shape} = a \gt 0 \\ \color{red}{\text{scale}} = b \gt 0\) Constant, monotonically increasing/decreasing
Weibull (PH)a \(a m t^{a-1} e^{-m t^a}\) \(1 - e^{-mt^a}\) \(amt^{a-1}\) \(\text{shape} = a \gt 0 \\ \color{red}{\text{scale}} = m \gt 0\) Constant, monotonically increasing/decreasing
Gompertz \(b e^{at} \exp\left[-\frac{b}{a}(e^{at}-1)\right]\) \(1 - \exp\left[-\frac{b}{a}(e^{at}-1)\right]\) \(b e^{at}\) \(\text{shape} = a \in (-\infty, \infty) \\ \color{red}{\text{rate}} = b \gt 0\) Constant, monotonically increasing/decreasing
Gammab \(\frac{b^a}{\Gamma(a)}t^{a -1}e^{-bt}\) \(\frac{\gamma(a, bt)}{\Gamma(a)}\) \(f(t)/S(t)\) \(\text{shape} = a \gt 0 \\ \color{red}{\text{rate}} = b \gt 0\) Constant, monotonically increasing/decreasing
Lognormal \(\frac{1}{t\sigma\sqrt{2\pi}}e^{-\frac{(\ln t - \mu)^2}{2\sigma^2}}\) \(\Phi\left(\frac{\ln t - \mu}{\sigma}\right)\) \(f(t)/S(t)\) \(\color{red}{\text{meanlog}} = \mu \in (-\infty, \infty) \\ \text{sdlog} = \sigma \gt 0\) Arc-shaped, monotonically decreasing
Log-logistic \(\frac{(a/b)(t/b)^{a-1}}{\left(1 + (t/b)^a\right)^2}\) \(\frac{1}{(1+(t/b)^a)}\) \(1-\frac{(a/b)(t/b)^{a-1}}{\left(1 + (t/b)^a\right)}\) \(\text{shape} = a \gt 0 \\ \color{red}{\text{scale}} = b \gt 0\) Arc-shaped, monotonically decreasing
Generalized gammac \(\frac{|Q|(Q^{-2})^{Q^{-2}}}{\sigma t \Gamma(Q^{-2})} \exp\left[Q^{-2}\left(Qw-e^{Qw}\right)\right]\) \(\begin{cases} \frac{\gamma(Q^{-2}, u)}{\Gamma(Q^{-2})} \text{ if } Q \neq 0 \\ \Phi(w) \text{ if } Q = 0 \end{cases}\) \(f(t)/S(t)\) \(\color{red}{\text{mu}} = \mu \in (-\infty, \infty) \\ \text{sigma} = \sigma \gt 0 \\ \text{Q} = Q \in (-\infty, \infty)\) Arc-shaped, bathtub-shaped, monotonically increasing/decreasing
a The proportional hazard (PH) model is a reparameterization of the accelerated failure time (AFT) model with \(m = b^{-a}\).
b \(\Gamma(z) = \int_{0}^{\infty} x^{z-1}e^{-x} dx\) is the gamma function and \(\gamma(s,x) = \int_{0}^{x} t^{s-1}e^{-t}dt\) is the lower incomplete gamma function.
c \(w = (log(t) - \mu)/\sigma; u = Q^{-2}e^{Qw}\).
# Read the data into R
surv_data <- read.csv("stroke_data.csv") |> 
  mutate(id= row_number())

take a look at the dataset

gt::gt(head(surv_data))
doa dod status sex dm gcs sbp dbp wbc time2 stroke_type referral_from id
17/2/2011 18/2/2011 alive male no 15 151 73 12.5 1 IS non-hospital 1
20/3/2011 21/3/2011 alive male no 15 196 123 8.1 1 IS non-hospital 2
9/4/2011 10/4/2011 dead female no 11 126 78 15.3 1 HS hospital 3
12/4/2011 13/4/2011 dead male no 3 170 103 13.9 1 IS hospital 4
12/4/2011 13/4/2011 alive female yes 15 103 62 14.7 1 IS non-hospital 5
4/5/2011 5/5/2011 dead female no 3 91 55 14.2 1 HS hospital 6
ggplotly(
  surv_data %>%
    mutate(
      text = paste("Subject ID = ", id, "<br>", "Time = ", time2, "<br>", "Event = ",  
                   status, "<br>", "gcs = ", round(gcs, 2), "<br>", "stroke_type = ", stroke_type)
    ) %>%
  ggplot(aes(x = id, y = time2, text = text)) +
    geom_linerange(aes(ymin = 0, ymax = time2)) +
    geom_point(aes(shape = status, color = status), stroke = 1, cex = 2) +
    scale_shape_manual(values = c(1, 3, 4)) +
    labs(y = "Time (years)", x = "Subject ID") + coord_flip() + theme_classic(),
  tooltip = "text"
)
## Error in `pm[[2]]`:
## ! subscript out of bounds

Data wrangling

  • data will not always come in the neatest case scenario hence you need to work on it through processes we call data wrangling and munging.
surv_data <- 
  surv_data |>
  mutate(doa = dmy(doa),
         dod = dmy(dod),
         time3=dod-doa,
         status2 = ifelse(status=="dead",1,0))

Intercept only model

Note

The best performing models are those that support monotonically increasing hazards (Gompertz, Weibull, gamma). the Gompertz model perform the best with the Gompertz modeling the increase in the slope of the hazard the most closely.

A Proportional Hazards Weibull Model

Note
  • Notice that the Weibull output has a parameter p that the exponential distribution does not have . The hazard function for a Weibull distribution is \(h(t)=\lambda pt^{p-1}\) , if \(p=1\) then the Weibull distribution is also an exponential distribution \(h(t)=\lambda\). By default Stata exponentiates the coefficients to show relative risks. Use the option nohr for no hazard ratios to obtain the coefficients.

A Proportional Hazards Exponential Model

Let us fit a proportional hazards model with an Exponential baseline, [using stset to set the data and survreg to fit the model. can do using survreg with dist set to “exponential”.

Accelerated Failure Time Weibull

Note

The relationship between the hazard ratio parameter \(\beta_j\) and the AFT parameter \(\alpha_j\) is \(\beta_j = -\alpha_jp\). For example, using the coefficient estimates for PRISON in the Weibull PH and AFT models yields the relationship \(0.8459015 =( 0.1508071)(1.109711 )\).

Weibull PH vs AFT equivalence

Weibull models can be written in two equivalent forms: proportional hazards (PH) and accelerated failure time (AFT).

In the AFT form:

\[ \log T = \mu + \sigma \varepsilon + x^\top \gamma, \qquad \varepsilon \sim \text{EV(type I)}, \]

with \(\sigma = 1/p\) for Weibull shape parameter \(p>0\).

The survival is

\[ S(t \mid x) = \exp\!\left\{ - \exp\!\left(\tfrac{\log t - \mu - x^\top \gamma}{\sigma}\right) \right\} = \exp\!\left\{ -\, t^{1/\sigma}\, \exp\!\left(-\tfrac{\mu+x^\top \gamma}{\sigma}\right) \right\}. \]

Let \(p=1/\sigma\). Then

\[ S(t \mid x) = \exp\!\left\{-\,\Lambda_0(t)\,\exp\!\big(-p\,x^\top\gamma\big)\right\}, \qquad \Lambda_0(t)=\exp(-p\mu)\,t^p. \]

In the PH form:

\[ S(t \mid x) = \exp\!\left\{-\,\Lambda_0(t)\,\exp\!\big(x^\top \beta_{\text{PH}}\big)\right\}. \]

By comparison,

\[ \beta_{\text{PH}} = -p\,\gamma \qquad\Longleftrightarrow\qquad \gamma = -\tfrac{\beta_{\text{PH}}}{p}. \]

A Log-Normal AFT Model

The Weibull model allows the hazard to increase or decrease with time, but at a constant rate. Wooldridge notes that the log-normal distribution provides a better fit to the data.

In Stata

Note

You may be interested to know that Stata and R report different log-likelihoods. This is because R works with the distribution of time and Stata with the distribution of log(time). The difference turns out to be the Jacobian of the transformation, which is the sum of log(t) over all failures, or 1559.1. Differences between log-likelihood are not affected by this constant term.

Back to top