Survival Models
Time-to-event models, unified by one idea — censoring as a probability mass over the region an event time is known to lie in. The arc starts with Weibull proportional hazards (parametric, right-censored, fit by MLE and Metropolis), extends it two ways, and generalises the censoring. The frailty model adds a per-subject random multiplier on the hazard — the hierarchical/random-effects extension, literally the survival likelihood × the hierarchical-Poisson sampler. The Cox-via-Poisson bridge fits the semiparametric Cox model as an ordinary Poisson GLM on expanded person-time (the piecewise-exponential = Poisson identity), making the recurring “survival is a count model” theme explicit. And interval-censored survival completes the censoring tour — one likelihood S(l) − S(u) that covers right, left, interval, and exact observations at once. Each is built from scratch and cross-checked across PyMC and R.
Bayesian Weibull Proportional-Hazards Model
Parametric survival regression — Weibull proportional hazards with right-censoring —
fit from scratch by both MLE and Bayesian RW-Metropolis. The new ingredient over every earlier
example is censoring: an event contributes the hazard × survival
h(t)S(t), a censored subject only the survival S(t), switched
by a single indicator. The hazard ratio is eβ and the Weibull shape
k sets whether risk rises, falls, or is constant (k=1, exponential). A nice
structural link: the Weibull log-likelihood is a Poisson
kernel in disguise (the piecewise-exponential trick). Three worked examples surface different
facets of the same model: Leuk (BUGS; 6-MP vs placebo) — a treatment effect,
the drug lowering relapse hazard ~5–6×; Mice (BUGS; 4 groups) — a multi-level
factor with a strong wear-out shape (k ≈ 3.2); and a reliability study
(Meeker & Escobar shock absorbers, 61% censored) — engineering life metrics
(characteristic life, B₁₀, MTTF) read straight off the posterior. Each is cross-checked against
PyMC (censored likelihood via pm.Potential) and R (survreg Weibull +
semiparametric coxph).
Bayesian Hierarchical Survival — Frailty Models
The hierarchical extension of the Weibull survival model: each subject carries a
frailty — an unobserved random multiplier on the hazard, the survival
analogue of a random intercept. The implementation is deliberately modular — literally the
survival likelihood × the
hierarchical-Poisson random-intercept sampler — since
the per-patient frailty update is identical in form to the Poisson random intercept, only the
likelihood term differs. The frailty absorbs unmeasured heterogeneity and models the
within-subject correlation of repeated event times. Applied to the BUGS Kidney data
(McGilchrist & Aisbett 1991; 2 infection recurrences per patient): women have a far lower
hazard (HR ≈ 0.15) and the frailty is real (σw ≈ 0.65, a ~10× robust-to-frail
spread). The honest headline is a method sensitivity — a Cox-frailty ML fit collapses
σw to 0 (boundary artefact, 38 clusters of 2) while the Bayesian posterior and
parametric ML keep it near 0.6. Cross-checked against PyMC, R parfm, and
coxme.
Bayesian Cox via Poisson — the Count–Survival Bridge
The semiparametric Cox proportional-hazards model fit as an ordinary
Poisson GLM on expanded person-time data —
the piecewise-exponential = Poisson identity (Holford 1980; Laird & Olivier
1981) behind BUGS Leuk and PyMC's survival case study. Splitting time at the event
times with a piecewise-constant baseline hazard turns survival estimation into a count model
with a log-exposure offset and interval intercepts — no parametric baseline assumed,
and eβ is just a Poisson-regression coefficient. Applied to two
datasets with the same module: Leuk (control-vs-6-MP HR ≈ 5, matching
coxph and the Weibull fit) and
mastectomy (metastasis raises death hazard ~2.3×). Closes the loop on the
recurring "survival is a count model" theme — and adding a random effect to this Poisson is
exactly the frailty model. Cross-checked against PyMC,
R survSplit + glm, and coxph.
Bayesian Interval-Censored Survival
The sequel to the Weibull survival model (which did
right-censoring only): when subjects are checked periodically, an event is known only to fall
between two visits — interval censoring. A single likelihood
S(l) − S(u) covers every censoring type at once (right when u=∞, left
when l=0, interval, and exact via the density), fit from scratch by MLE and Bayesian
RW-Metropolis. This completes the censoring tour started with right-censored survival and the
Tobit: censoring is one idea — a probability mass over
the region the value is known to lie in. Applied to the classic mouse lung-tumour data (Hoel
& Walburg 1972; no exact onset times): germ-free mice have ~2.2× the tumour hazard, with a
careful competing-risks/longevity reading of the "germ-free puzzle." Cross-checked against PyMC
and R (survreg interval2, icenReg::ic_par).