Mathematical foundations¶
The formulation behind each generator. Every model page repeats the part relevant to it; this page puts them side by side and fixes notation.
Throughout, \(T\) is the event time, \(C\) the censoring time, \(X\) a covariate vector, and the observed pair is \((\min(T, C), \mathbb{1}\{T \le C\})\).
Three equivalent ways to describe a survival distribution:
Sampling works through the last of these: draw \(U \sim \mathrm{Uniform}(0,1)\) and solve \(S(T) = U\). Every generator here is some version of that inversion.
1. Cox proportional hazards¶
The hazard splits into a baseline and a covariate multiplier:
The ratio of hazards for two subjects is \(\exp((X_1 - X_2)^\top\beta)\) — constant
in \(t\), which is what "proportional" means. cphm uses a constant baseline
\(h_0(t) = 1\), so
drawn by inversion as \(T = -\log(U)/\exp(X^\top\beta)\).
With a Weibull baseline \(h_0(t) = \lambda\rho t^{\rho-1}\) the cumulative hazard is \(\Lambda_0(t) = \lambda t^{\rho}\) and
which is what the Weibull AFT generator produces in its PH parameterisation.
→ cphm
2. Accelerated failure time¶
Instead of scaling the hazard, scale time:
so \(S(t \mid X) = S_0\!\left(t e^{-X^\top\beta}\right)\): a covariate stretches or compresses the whole survival curve. The distribution of \(\varepsilon\) picks the family.
Log-normal. \(\varepsilon \sim \mathcal{N}(0,1)\), giving
with \(\Phi\) the standard normal CDF. The hazard rises then falls.
Weibull. The only family that is both AFT and PH. gen_surv draws it as
which is the PH parameterisation — \(\beta\) is a log hazard ratio, and its effect on \(\log T\) is \(-\beta/\texttt{shape}\).
Log-logistic. \(S(t) = \big(1 + (t/\texttt{scale})^{\texttt{shape}}\big)^{-1}\), giving a unimodal hazard: rising to a peak, then decaying. Not a PH family.
3. Piecewise exponential¶
Partition follow-up at \(0 < \tau_1 < \dots < \tau_k\) and hold the hazard constant on each piece:
The cumulative hazard is piecewise linear,
and inversion walks the intervals, consuming exponential "budget" until it runs out inside one of them. With enough pieces this approximates any hazard shape.
4. Competing risks¶
With \(K\) causes, each has a cause-specific hazard
The all-cause hazard is \(\sum_k h_k\), and the observed pair is \((T, \delta) = (\min_k T_k, \arg\min_k T_k)\).
The quantity usually reported is the cumulative incidence
which depends on all the hazards through \(S\) — this is why a Fine-Gray subdistribution coefficient does not equal the cause-specific \(\beta_k\) that generated the data.
5. Mixture cure¶
A latent indicator \(Y\) marks the uncured, with \(\Pr(Y = 1 \mid X)\) logistic in \(X\). The population survival function mixes a point mass at infinity with a proper distribution:
where \(\pi(X)\) is the cure probability and \(S_u\) the survival function of the
uncured. As \(t \to \infty\), \(S_{\text{pop}} \to \pi(X)\) — the plateau. gen_surv
takes \(S_u\) exponential with hazard \(\lambda\exp(X^\top\beta_{\text{surv}})\).
6. Multi-state models¶
States \(\{1, 2, 3\}\) = healthy, ill, dead, with transition intensities
For a time-homogeneous chain the intensities are constant, the generator matrix \(Q\) has \(Q_{ij} = \alpha_{ij}\) and \(Q_{ii} = -\sum_{j \ne i}\alpha_{ij}\), and transition probabilities follow from the matrix exponential:
Sojourns are exponential and memoryless. That is thmm,
with \(\alpha_{ij} = \lambda_{ij}\exp(\beta_{ij}X)\).
cmm instead draws Weibull sojourns,
on a clock that resets when a subject enters state 2. The intensity of dying then depends on time since illness rather than time since entry, making the process semi-Markov rather than Markov.
7. Time-dependent covariates¶
When a covariate changes during follow-up the hazard is
and the partial likelihood needs \(Z(t)\) evaluated at each event time — hence
the (start, stop] layout that survival software expects. gen_surv simulates
a single switch from 0 to 1 at a crossover time correlated with the baseline
covariate.
→ tdcm
Censoring¶
All generators apply independent right-censoring: \(C \perp T \mid X\), with
Independence is what makes the standard estimators unbiased here. To break it deliberately, see Censoring.
Some models add administrative censoring at max_time, which is deterministic
and also independent of \(T\).
Further reading¶
See the bibliography for the sources behind each of these.