Bayesian Cox Regression

Statistics
Introduced by
Cox (1972) for the base model; Bayesian formulation by Sinha, Chen & Ghosh (1990s); comprehensive treatment by Ibrahim, Chen & Sinha (2001)
Year
1972 (Cox PH); 2001 (Bayesian treatment)
Type
Survival regression
Family
Regression / GLM

What does it do?

Bayesian Cox regression applies Bayesian inference to the Cox proportional hazards model for time-to-event data.

Rather than returning a single point estimate for each hazard ratio, it yields a posterior distribution over the coefficients, which is combined with prior information. This gives a full probabilistic summary of uncertainty about the hazard ratios, which can be useful when samples are small or prior knowledge is available.

The intuition behind the method

The Cox model asks how the instantaneous risk of an event changes with covariates. Classically it gives a single best-estimate hazard ratio with a confidence interval. The Bayesian version treats those hazard ratios as uncertain quantities described by probability distributions. You start with a prior belief, update it with the survival data, including censored observations, and obtain a posterior distribution that describes the range of plausible hazard ratio values and how probable each part of that range is.

History

David Cox introduced the proportional hazards model in his 1972 paper, Regression models and life-tables. Bayesian formulations of the Cox model developed from the 1990s onward. Ibrahim, Chen and Sinha's 2001 monograph Bayesian Survival Analysis is a comprehensive treatment of the topic. Later probabilistic programming tools, such as Stan, have made fully Bayesian fitting of such models more accessible to applied researchers.

When to use it

Use Bayesian Cox regression when you have time-to-event outcomes with censoring and need more than point estimates, especially when the sample is small or moderately sized, prior information from previous studies is available, complete uncertainty propagation is required (e.g., for decision analysis), or the goal is model comparison via information criteria. It is also preferable when classical maximum partial likelihood produces unstable estimates due to sparse data or many tied event times. Avoid it when the dataset is very large and computational cost is prohibitive, or when a classical Cox model already yields stable estimates and transparent frequentist inference is required by the research context.

Limitations and considerations

  • MCMC sampling of the baseline hazard is considerably slower than maximizing the classical partial likelihood, which becomes a practical constraint on large datasets.
  • Results can be sensitive to the prior on the baseline hazard, and a poorly chosen prior can distort inference when data are sparse.
  • Specifying priors, checking MCMC diagnostics (Rhat, effective sample size) and performing model checks requires more expertise than standard Cox regression.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Full posterior distributions over hazard ratios allow direct probability statements, such as P(HR > 1) = 0.95, instead of a binary significance decision.
  • Prior distributions formally incorporate historical data or expert knowledge on the log hazard ratios, which can reduce posterior uncertainty when the sample is small.
  • Right-censoring enters the likelihood through the survival function, so censored subjects contribute information without being discarded; other censoring or truncation mechanisms can be added to the model but must be specified explicitly.
  • WAIC and LOO-CV can compare models without requiring that the models be nested.
  • Posterior predictive survival curves with credible bands are available for individual-level prognosis.

Applications

  • Clinical trials: estimating treatment hazard ratios for time-to-event endpoints such as mortality, relapse or progression, with posterior uncertainty reported alongside the estimate.
  • Epidemiology: modeling time to disease onset, with prior cohort information used to stabilise estimates in rare-disease studies.
  • Engineering reliability: predicting component failure times, with priors informed by manufacturer specifications where these are available.
  • Health economics: constructing posterior survival curves for cost-effectiveness models that require propagation of parameter uncertainty.
  • Prognostic model development: producing individual-level posterior predictive survival probabilities with credible intervals.

How it works

How it works

1

The conditional hazard at time t given covariates x is modeled as the product of a baseline hazard h0(t) and an exponential linear predictor exp(x'β). The log hazard ratios β are the parameters of primary interest.

Formula
h(t|x) = h_0(t)\exp(x^{\top}\beta)
2

Priors are placed on the regression coefficients β and, if modeled explicitly, on the baseline hazard h0(t). Common choices include weakly informative normal priors on β and a piecewise-constant or gamma process prior on h0(t). Informative priors can incorporate historical data or expert knowledge.

Formula
\pi(\beta, h_0)
3

The likelihood multiplies, over subjects, the hazard raised to the event indicator δi by the survival function S(ti|xi), so it depends on both β and the baseline hazard h0. Because it includes h0 and S explicitly, it is a full likelihood rather than Cox's partial likelihood, which eliminates h0. Right-censored observations (δi = 0) contribute through S alone. This form assumes non-informative (conditionally independent) right censoring: given the covariates, the censoring time carries no information about the subject's event hazard. If censoring is informative, for example when dropout is related to prognosis, the assumption fails and the censoring process must be modelled explicitly. Other censoring or truncation mechanisms also require their own specification.

Formula
L(\beta, h_0 | \text{data}) = \prod_i h(t_i|x_i)^{\delta_i} S(t_i|x_i)
4

Bayes' theorem combines the likelihood and prior: the posterior is proportional to their product. Because the baseline hazard is often high-dimensional, the posterior is typically explored via Markov Chain Monte Carlo (MCMC) samplers such as Hamiltonian Monte Carlo (HMC) or Gibbs sampling.

Formula
\pi(\beta, h_0 | \text{data}) \propto L \cdot \pi(\beta, h_0)
5

Posterior summaries, including means, medians, credible intervals, and posterior predictive survival curves, are extracted from the MCMC draws. Model comparison uses the widely applicable information criterion (WAIC) or leave-one-out cross-validation (LOO-CV).

Common pitfalls

  • Using flat or improper priors on the baseline hazard without checking that the posterior is proper may cause the sampler to diverge.
  • Ignoring MCMC convergence diagnostics: inspect Rhat (should be below 1.01) and trace plots before trusting posterior summaries.
  • Reporting a 95% credible interval to a non-Bayesian audience as if it were a frequentist confidence interval; state the interpretation explicitly.
  • Assuming proportional hazards without checking it. The Bayesian formulation does not relax this assumption. Plot Schoenfeld residuals against time and test each covariate separately; a clear trend with time, or a small p-value for that covariate, indicates that its effect varies over follow-up.
  • Confusing marginal and conditional hazard ratio interpretations when random effects or frailty terms are included in the model.
  • Assuming non-informative censoring without considering the study design. If follow-up is cut short for patients who are doing badly, or if dropout depends on prognosis, the posterior can be biased. Check that censoring is plausibly unrelated to outcome before fitting.

Frequently asked questions

Do I need to specify a prior for the baseline hazard?

Yes, in a fully Bayesian Cox model the baseline hazard h0(t) must be assigned a prior. Common choices are a piecewise-constant hazard with gamma priors on each piece, or a gamma process prior. Software such as Stan, rstanarm or brms can fit these models, but check which baseline hazard each package implements and what its default priors are, and examine how sensitive key posterior quantities are to the prior specification.

How does this differ from the classical Cox model?

The classical Cox model uses partial likelihood to estimate β without modeling h0(t), giving point estimates and confidence intervals based on asymptotic theory. The Bayesian version places priors on both β and h0(t) and produces full posterior distributions, which are more informative about uncertainty and allow coherent probabilistic predictions.

Is the proportional hazards assumption still required?

Yes. The Bayesian framework does not relax the proportional hazards assumption. Check it with Schoenfeld residuals plotted against time and tested for each covariate, for example using a classical Cox fit to the same data. If a covariate's effect changes over follow-up, add a time-by-covariate interaction, stratify on that covariate, or consider a Bayesian accelerated failure time model. In that case, do not report a single pooled hazard ratio as valid across the whole follow-up period.

Which software can I use for Bayesian Cox regression?

Stan, rstanarm, brms (which provides censored-response families) and JAGS are commonly used for fitting Bayesian models of this kind. Check each package's documentation for the survival likelihood it implements, because classical survival packages such as survival do not provide Bayesian fitting.

How do I compare two Bayesian Cox models?

Use the widely applicable information criterion (WAIC) or leave-one-out cross-validation (LOO-CV) implemented in the loo R package. These penalize model complexity while rewarding predictive accuracy and do not require the models to be nested.

Related methods

Sources

  1. Ibrahim, J. G., Chen, M.-H., & Sinha, D. (2001). Bayesian Survival Analysis. Springer.

    ISBN: 978-0387952772
  2. Cox, D. R. (1972). Regression models and life-tables. Journal of the Royal Statistical Society, Series B, 34(2), 187–220.

    Open publication reference