Survivalstan is a library of Survival Models written in Stan

It also contains a number of utility functions helpful when doing survival analysis.

Typical usage:

import survivalstan
# .. prep your data
fit1 = survivalstan.fit_stan_survival_model(...)
survivalstan.utils.plot_stan_summary([fit1], metric=’Rhat’)


  • Variety of standard survival models
    • Weibull, Exponential, and Gamma parameterization
    • A variety of semi-parametric and non-parametric baseline hazards
    • Supports time-varying-coefficients
    • Estimate time-varying effects
    • Varying-effects by group
  • Extensible framework - bring your own Stan code, or edit the models provided

  • Uses pandas data frames & patsy formulas

  • Graphical posterior predictive checking

  • Plot posterior estimates of key parameters using seaborn

  • Annotated posterior draws of parameter estimates, as pandas dataframes

  • Supports caching via stancache or pystan-cache


Install survivalstan via pip:

pip install survivalstan


If you are having issues or questions, please let us know.

Please submit an issue github or via gitter


The project is licensed under the Apache 2.0 license.


`Documentation`_ is available online.