Fast Bayesian Survival Inference
Fast Variational Bayesian Inference for the Weibull AFT Model
Mean-field variational Bayes for right-censored Weibull AFT models, using 100-segment piecewise approximations for closed-form coordinate-ascent updates.
- Type
- Research
- Context
- MSc research project · Western University
- Focus
- Bayesian inference · Survival analysis · R · Stan
- Highlight
- 453× faster fits vs. MCMC · 3,000 simulations
#My contribution
Independently extended a piecewise-conjugate variational framework to derive and implement a mean-field variational Bayes algorithm in R for right-censored Weibull AFT models, using 100-segment linear and quadratic approximations for closed-form coordinate-ascent updates.
This work was completed as my MSc research project in the Department of Statistical and Actuarial Sciences at Western University (supervised by Dr. Camila P. E. de Souza), with planned incorporation into the survregVB R package.
#Method and derivation
On the log-time scale, the Weibull accelerated failure time (AFT) model writes
where follows the standard minimum extreme-value distribution and is the log-time error scale (equivalent to Weibull shape ). Under right censoring, the log-likelihood contains the nonlinear term for every observation, which couples and and prevents conjugate conditional updates.
Extending the piecewise-conjugate strategy originally introduced for log-logistic AFT models, I placed independent priors on and adopted a mean-field variational family:
Piecewise polynomial grid: partitioned the standardized residual domain into 100 equal-width segments, precomputing least-squares linear and quadratic approximations to over 300 equally spaced points per segment (clamping out-of-range residuals to the nearest endpoint segment).
Closed-form CAVI updates: before each coordinate step, each observation selects its active segment from the expected standardized residual
The quadratic approximation yields a Gaussian precision-and-mean update for , while the linear approximation retains only and terms to produce an Inverse-Gamma update for .
Convergence monitoring: derived the corresponding approximate ELBO (retaining quadratic intercepts for ELBO evaluation) and stopped coordinate ascent when either the absolute ELBO change or the change in fell within tolerance .
#Simulation study
I implemented the solver, simulation drivers, and diagnostics in R and ran two paired simulation studies against maximum likelihood (survival::survreg) and Stan MCMC (4 chains, 2,000 iterations with 1,000 warmup; 4,000 retained posterior draws).
#Accuracy, calibration, and speed (3,000 datasets)
The primary study crossed sample sizes with target censoring rates of 0%, 15%, and 30% (six scenarios, 500 retained datasets each):
| Scenario (, censoring) | VB time (s) | Stan MCMC time (s) | MCMC / VB |
|---|---|---|---|
| , 0% | 1.023 | 341.38 | 334× |
| , 15% | 0.907 | 338.02 | 373× |
| , 30% | 0.758 | 330.20 | 436× |
| , 0% | 1.303 | 610.88 | 469× |
| , 15% | 1.199 | 611.41 | 510× |
| , 30% | 1.025 | 612.69 | 598× |
- Speed-up scope: cumulative fitting times across 500 retained datasets yielded an average 453× success-only fitting-time speed-up over Stan MCMC (range 334×–598×). This measures successful fitting calls only—excluding unsuccessful VB attempts, interval construction, diagnostics, and Stan's 17.35 s compilation—rather than end-to-end wall-clock runtime.
- Point accuracy: across all 24 scenario–parameter combinations, VB closely matched MCMC and
survreg; the largest absolute difference between VB and MCMC empirical SDs was 0.0017, and the largest absolute MSE difference was 0.0010. - Interval calibration: nominal 95% credible intervals for regression coefficients achieved 93.4%–96.4% empirical coverage across all three methods. For the scale parameter , VB's mean-field intervals were 24%–28% wider than MCMC's, yielding conservative coverage of 98.2%–99.2% (vs. 92.6%–95.4% for MCMC).
#Small-sample prior sensitivity (n = 30)
A second study evaluated across 0%, 15%, and 30% censoring (500 datasets per rate) under weak and strong priors compared against survreg:
- Averaged across censoring rates, weak-prior VB reduced MSE relative to
survregby 27.3% (), 27.1% (), 5.1% (), and 47.7% () (up to ~48%), driven primarily by lower sampling variance. - The stronger prior further lowered regression-coefficient MSE (up to 35.0% vs.
survreg) and moved coverage closer to nominal (93.8%–96.2%), while increasing the MSE of by 16.3% relative to the weak prior—illustrating a concrete parameter-specific bias–variance trade-off.
#METABRIC breast-cancer application
I applied the method to 1,815 complete-case METABRIC breast-cancer patients (1,041 deaths, 774 censored; 42.6% censoring; median observed follow-up 114.6 months) with an intercept and 11 covariate terms covering age at diagnosis, tumour size and positive lymph nodes (standardized), histologic grade, ER/HER2/PR status, chemotherapy, hormone therapy, and radiotherapy.
- Posterior agreement: VB closely reproduced Stan MCMC point estimates and 95% credible intervals across all 11 covariates and the scale parameter ( vs. for MCMC; Stan diagnostics showed , , and zero divergences).
- Interpretable time ratios: under the AFT parameterization (), older age (0.678 per SD), larger tumour size (0.861 per SD), more positive lymph nodes (0.778 per SD), grade 3 disease (0.796 vs. grade 1), and HER2-positive status (0.780) were associated with shorter survival, whereas hormone therapy (1.138) and radiotherapy (1.235) were associated with longer survival. Because METABRIC is observational, these represent adjusted associations rather than causal treatment effects.
- Model diagnostic: the Kaplan–Meier survival curve of Cox–Snell residuals tracked the reference closely over most of the residual range, with mild right-tail separation where fewer patients remained under observation.