mjskay / tidybayes

Bayesian analysis + tidy data + geoms (R package)
http://mjskay.github.io/tidybayes
GNU General Public License v3.0
712 stars 59 forks source link

stat_dist_slabinterval and the inverse gamma distribution #230

Closed ASKurz closed 3 years ago

ASKurz commented 4 years ago

Is it possible to use the family of stat_dist_slabinterval() functions to compute the analytic solution for the inverse gamma distribution? Within the brms framework, that's used as one of the default priors for gaussian process models. Paul currently refers to it as inv_gamma within the prior() function. I tried using that and similar terms (e.g., invgamma) for the the dist argument to no avail.

mjskay commented 4 years ago

Under the hood those geoms just look for the typical R functions defined for a distribution (eg dinvgamma, pinvgamma, etc). As long as those functions are defined using the same parameterization Stan uses it should work. So you could see if there's a package out there with the inverse gamma distribution.

mjskay commented 4 years ago

@ASKurz you might be interested in the conversation happening about improving the distribution lookup for parse_dist() happening here: #231. Would love any thoughts you have on that issue, especially as a power user of these APIs and as someone with experience teaching others how they work.

ASKurz commented 4 years ago

Pardon me. I didn’t mean to neglect this issue. But as to #231, holy smokes I love where y'all are headed!

mjskay commented 4 years ago

Oh no worries!

I might just close this one if that's alright with you, since I think the solution will be subsumed there. In the meantime if you haven't found it already, loading the {invgamma} R package should allow you to use inverse gamma with stat_dist_...: https://cran.r-project.org/web/packages/invgamma/index.html