I have put together some basic material on survival analysis. It is available as:

- .html document with highlighted syntax here.
- Printer-ready .pdf document here.
- GitHub repository with all the source files here.

Main motivation was that I wanted to learn the basics myself; also, it's tricky to find simple examples of survival models fitted in Bayesian setting and there are few materials that combine theory with examples.

The material contains:

- Mathematical formulations of key concepts of survival analysis.
- Illustration of the exponential model of failure density.
- Example of the exponential model fitting in R.
- Example of the same model fitting in JAGS.
- More complex model with censoring in JAGS.

(Visited 2,693 times, 1 visits today)

Thanks! This is indeed very helpful.

Do you also plan to illustrate how to use STAN (http://mc-stan.org/rstan.html) to fit a survival model in a Bayesian setting? See this blog post (http://www.r-bloggers.com/jags-and-stan/) for a short comparison of STAN and JAGS.

Backtracking on the URL, the "document with unknown author" seems to be by Joseph G. Ibrahim, available (and attributed) [here](http://www.amstat.org/chapters/northeasternillinois/pastevents/summer05.htm).

Thanks Gregor for spotting this. I have updated the text so that J.G. Ibrahim is now acknowledged.

Howdy,

In the second section, you say that Mean time to death (μ) for continuous S(t) is

μ=∫∞0uf(u)du . This can also be written as μ=∫∞0S(u)du. Often times, this is easier to deal with. It isn't clear in here that this is the case, but I do believe this is important.

It is pretty great other than that, thanks!

Thanks Jonah! I have added a note on that.

Great!

For those interested, here is a proof of why.

http://thirdorderscientist.org/homoclinic-orbit/2013/6/25/the-darth-vader-rule-mdash-or-computing-expectations-using-survival-functions

Brilliant, thanks!

Great post! I came across it, while I was preparing a post myself over the weekend on insurance claims analysis. I ended up with the same model, using a gamma prior and an exponential likelihood. However, I use Stan instead of Jags: http://www.magesblog.com/2015/05/posterior-predictive-output-with-stan.html

I have yet to figure out how to get the confidence interval around the posterior predictive distribution out of Stan.

Brilliant Petr, very cleanly done. I was looking for something like this. Thanks for your effort!

My only question is why you chose an exponential function, and the biological interpretation of such a choice. Have you seen it done in other ways? I just needed one or two more lines under subheading 3.

For the last example, I was able to get JAGS and survreg to agree by changing the data list passed to JAGS to:

roaches.data <- list(t.to.death = t.to.death,

t.cen = t.cen,

N = nrow(roaches),

weight = roaches$weight,

is.censored = is.censored) # added