Generalized gamma distributions

Hi,

I was wondering whether there are any plans of adding generalized gamma distribution to Stan. It’s a commonly used distribution especially in survival analysis since it incorporates Weibull, gamma, and lognormal as special cases. The distribution is available in JAGS, however, I am planning to work with the stan_surv function from rstanarm, which I find extremely promising, so I would be interested in using Stan instead of JAGS.

I do not have sufficient knowledge to propose anything, but there were some posts suggesting how it could be done parameterizations:

Cheers,
Frantsek

The generalized gamma works fine in Stan currently, although you would need to grab one of the parametrizations people have posted and sort out the parameters.

There are some implementations of mine here: tooling/models/stan-lang/functions at master · sakrejda/tooling · GitHub

Those Stan functions are in a package and unit tested against the R implementations here: tooling/code/waitup/waitup/R at master · sakrejda/tooling · GitHub

2 Likes

Thank you!

If I understand correctly, it’s not part of the Stan language (as other distributions like normal, Cauchy, and etc…) yet, right? Is there a plan to add it there as well in the future?

I did want to add those distributions and we had some dev discussion about it but there wasn’t much support for including them in the language. They work fine as user defined functions though.

Not all the parametrizations of the generalized gamma work well near the boundaries, such as when the data is actually gamma distributed, but one of them was pretty stable (as was the weibull and the other outlier-friendly gamma in the package).

1 Like

OK, thank you very much! That completely answers my question.

@sakrejda which parameterization ended up being the most stable for you?

I think it’s totally OK to add standard distributions to Stan. I don’t think anyone will object. It’s just a matter of whether anyone’s willing to put in the work to code and review.

@sakrejda In your generalized gamma code, you reference a 1992 paper (or perhaps book?) by Lawless. Would you happen to remember the title?

Did I manage to include the citation without a reference… I’m so sorry… it was a book… I believe it was this one: Lawless, J. F. (1982). Statistical Models and Methods for Lifetime Data. John Wiley,
New York. I likely used it only when I was looking for various parameterizations of the generalized gamma (?)

edit: corrected which book

corrected which book, I think I actually meant 1982, that book has some discussion of various parameterizations of the Gamma including location-scale and I likely applied it to the generalized gamma (not sure if the generalized gamma is discussed directly in the book)

last correction: the 1982 book does discuss generalizations of the Gamma!

Excellent, thanks for providing the reference.