(weibull_aft)=
:::{post} January 17, 2023 :tags: censored, survival analysis, weibull :category: intermediate, how-to :author: Junpeng Lao, George Ho, Chris Fonnesbeck :::
:::{include} ../extra_installs.md :::
The {ref}previous example notebook on Bayesian parametric survival analysis <bayes_param_survival_pymc3> introduced two different accelerated failure time (AFT) models: Weibull and log-linear. In this notebook, we present three different parameterizations of the Weibull AFT model.
The data set we'll use is the flchain R data set, which comes from a medical study investigating the effect of serum free light chain (FLC) on lifespan. Read the full documentation of the data by running:
print(sm.datasets.get_rdataset(package='survival', dataname='flchain').__doc__).
pm.PotentialWe have an unique problem when modelling censored data. Strictly speaking, we don't have any data for censored values: we only know the number of values that were censored. How can we include this information in our model?
One way do this is by making use of pm.Potential. The PyMC2 docs explain its usage very well. Essentially, declaring pm.Potential('x', logp) will add logp to the log-likelihood of the model.
However, pm.Potential only effect probability based sampling this excludes using pm.sample_prior_predictice and pm.sample_posterior_predictive. We can overcome these limitations by using pm.Censored instead. We can model our right-censored data by defining the upper argument of pm.Censored.
This parameterization is an intuitive, straightforward parameterization of the Weibull survival function. This is probably the first parameterization to come to one's mind.
Note that, confusingly, alpha is now called r, and alpha denotes a prior; we maintain this notation to stay faithful to the original implementation in Stan. In this parameterization, we still model the same parameters alpha (now r) and beta.
For more information, see this Stan example model and the corresponding documentation.
In this parameterization, we model the log-linear error distribution with a Gumbel distribution instead of modelling the survival function directly. For more information, see this blog post.
pm.Potential with pm.Censored by Jonathan Dekermanjian on Nov 25, 2024.:::{include} ../page_footer.md :::