Survival Distributions in R

Overview

This page summarizes common parametric distributions in R, based on the R functions shown in the table below.

Parametric survival distributions in R
DistributionDensityCDFHazardCumulative hazardRandom sample
Exponentialdexppexpflexsurv::hexpflexsurv::Hexprexp
Weibull (AFT) dweibullpweibullflexsurv::hweibullflexsurv::Hweibullrweibull
Gammadgammapgammaflexsurv::hgammaflexsurv::Hgammargamma
Lognormal dlnormplnormflexsurv::hlnormflexsurv::Hlnormrlnorm
Gompertz flexsurv::dgompertzflexsurv::pgompertzflexsurv::hgompertzflexsurv::Hgompertzflexsurv::rgompertz
Log-logistic flexsurv::dllogisflexsurv::pllogisflexsurv::hllogisflexsurv::Hllogisflexsurv::rllogis
Generalized gamma (Prentice 1975) flexsurv::dgengammaflexsurv::pgengammaflexsurv::hgengammaflexsurv::Hgengammaflexsurv::rgengamma

General Survival Distributions

Survival function: \(\begin{aligned} S(t) = Pr(T > t) = \exp\left(-H(t)\right) \end{aligned}\)

Hazard function: \(\begin{aligned} h(t) = f(t)/S(t) \end{aligned}\)

Cumulative hazard function: \(\begin{aligned} H(t) = \int_0^t h(z)dz = -log S(t) \end{aligned}\)

Exponential Distribution

Notation: \(\lambda > 0\) (rate)

Density: \(f(t) = \lambda e^{-\lambda t}\)

Survival: \(S(t) = e^{-\lambda t}\)

Hazard: \(h(t) = \lambda\)

Cumulative hazard: \(h(t) = \lambda t\)

Mean: \(1/\lambda\)

Median: \(\ln(2)/\lambda\)

Weibull Distribution

Notation: \(\kappa > 0\) (shape), \(\eta > 0\) (scale), \(\Gamma(x)\) = gamma function

Density: \(f(t) = \frac{\kappa}{\eta}\left(\frac{t}{\eta}\right)^{\kappa -1}e^{-(x/\eta)^\kappa}\)

Survival: \(S(t) = e^{-(t/\eta)^\kappa}\)

Hazard: \(h(t) = \frac{\kappa}{\eta}\left(\frac{t}{\eta}\right)^{\kappa -1}\)

Cumulative hazard: \(H(t) = \left(\frac{t}{\eta}\right)^\kappa\)

Mean: \(\eta \Gamma(1 + 1/\kappa)\)

Median: \(\eta (\ln(2))^{1/\kappa}\)

Notes: The exponential distribution is a special case of the Weibull with \(\kappa = 1\) and \(\lambda = 1/\eta\)

Gamma Distribution

Notation: \(a > 0\) (shape), \(b > 0\) (rate), \(\gamma(k, x) = \int_0^x z^{k-1}e^{-z}dz\) is the lower incomplete gamma function

Density: \(f(t) = \frac{b^a}{\Gamma(a)}t^{a -1}e^{-bt}\)

Survival: \(S(t) = 1 - \frac{\gamma(a, bt)}{\Gamma(a)}\)

Mean: \(a/b\)

Notes: When \(a=1\), the gamma distribution simplifies to the exponential distribution with rate parameter \(b\).

Lognormal Distribution

Notation: \(\mu \in (-\infty, \infty)\) (mean), \(\sigma > 0\) (standard deviation), \(\Phi(t)\) is the CDF of the standard normal distribution

Density: \(f(t) = \frac{1}{t\sigma\sqrt{2\pi}}e^{-\frac{(\ln t - \mu)^2}{2\sigma^2}}\)

Survival: \(1- \Phi\left(\frac{\ln t - \mu}{\sigma}\right)\)

Mean: \(e^{\mu + \sigma^2/2}\)

Median: \(e^\mu\)

Gompertz Distribution

Notation: \(a \in (-\infty, \infty)\) (shape), \(b > 0\) (rate)

Density: \(f(t) = be^{at}\exp\left[-\frac{b}{a}(e^{at}-1)\right]\)

Survival: \(S(t) = \exp\left[-\frac{b}{a}(e^{at}-1)\right]\)

Hazard: \(h(t) = be^{at}\)

Cumulative Hazard: \(H(t) = \frac{b}{a}\left(e^{at}-1\right)\)

Median: \(\frac{1}{b}\ln\left[-(1/a)\ln(1/2) + 1\right]\)

Notes: When \(a=0\) the Gompertz distribution is equivalent to the exponential with constant hazard and rate \(b\).

Log-logistic Distribution

Notation: \(\kappa>0\) (shape), \(\eta > 0\) (scale)

Density: \(\begin{aligned} f(t) =\frac{(\kappa/\eta)(t/\eta)^{\kappa-1}}{\left(1 + (t/\eta)^\kappa\right)^2} \end{aligned}\)

Survival: \(\begin{aligned} S(t) = \frac{1}{(1+(t/\eta)^\kappa)} \end{aligned}\)

Hazard: \(\begin{aligned} h(t) =\frac{(\kappa/\eta)(t/\eta)^{\kappa-1}}{\left(1 + (t/\eta)^\kappa\right)} \end{aligned}\)

Median: \(\eta\)

Mean: If \(\kappa > 1\), \(\begin{aligned} \frac{\eta (\pi/\kappa)}{\sin(\pi/\kappa)}; \end{aligned}\) else undefined

Generalized Gamma Distribution

Notation: \(\mu \in (-\infty, \infty)\) (location parameter), \(\sigma > 0\) (scale parameter), \(Q \in (-\infty, \infty)\) (shape parameter), $w = (log(t) - \mu)/\sigma$, and $u = Q^{-2}e^{Qw}$

Density: \(\begin{aligned} f(t) = \frac{|Q|(Q^{-2})^{Q^{-2}}}{\sigma t \Gamma(Q^{-2})} \exp\left[Q^{-2}\left(Qw-e^{Qw}\right)\right] \end{aligned}\)

Survival: \(\begin{aligned} S(t) = \begin{cases} 1 - \frac{\gamma(Q^{-2}, u)}{\Gamma(Q^{-2})} \text{ if } Q \neq 0 \\ 1 - \Phi(w) \text{ if } Q = 0 \end{cases} \end{aligned}\)

Notes: Simplifies to lognormal when \(Q=0\), Weibull when \(Q=1\), exponential when \(Q=\sigma=1\), and gamma when \(Q = \sigma\)