Competing risks survival models

Has anyone previously implemented a competing risks survival model in Stan and have some example code they’d like to share? (The seminal example of this kind of model is Fine and Gray).

1 Like

I’m not sure but if you can write down the log-likelihood then we can help you implement it. You can use $ around math expressions (latex via mathjax), which makes it easier to do that here in the forum than it used to be. I think doing that would help get more eyes on it here.

Thanks, I think I can most likely figure it out on my own, just wanted to see if anyone had put some thought into it already before starting from scratch! Appreciate the helpfulness of all the devs here!

That’s great to know, and definitely a huge improvement to the forum!

1 Like

I’ve been working on semicompeting risks in Stan from a causal inference perspective, but you could adapt the ideas if you cannot find readymade competing risks code. For the log-likelihood, I went through the online supplemental materials of a few papers (especially Lee et al 2015) until I felt like I understood the likelihood. Truncation and censoring are distinct concepts but they end up looking similar in the likelihood formulation.

One stumbling block for me has been getting parameters on roughly the same scale. I am using Weibull models with a proportional hazards formulation, and the time scales can be very different for the different event models. Noncentered parameterizations have not fixed convergence problems so far (or my models are not simple enough yet – definitely possible). It makes me curious as to how others have successfully fit parametric survival models in Stan. I do not want conclusions about my covariate effects to be sensitive to whether I have my event times coded in days or years, but I haven’t settled on the best way to achieve that invariance.

I have some very early stage stuff on my github (like here) if you’re desperate for a prototype, but nothing close to a finished product. I hope you’ll share what you learn as you implement this.

1 Like

What do the posteriors look like? Anything with lots of posterior dependency?

You just need to scale the priors to the scale of the data. A normal(0, sigma) prior on effect/year be a normal(0, 365.25 * sigma) parameter on effect/day.