Inverse Gamma Distribution

16 views
Skip to first unread message

Claus Möbus

unread,
Aug 20, 2020, 10:56:19 AM8/20/20
to webppl-dev
Hi,
I need a prior for the variance of a Gaussian likelihood. For that I need to sample values from the inverse Gamma (https://en.wikipedia.org/wiki/Inverse-gamma) distribution. Unfortunately the inverse Gamma is not in WebPPLs distribution library. I would like to stick to the inverse Gamma, if possible.
Best, Claus

null-a

unread,
Aug 20, 2020, 1:38:25 PM8/20/20
to webppl-dev
Hi. There's no primitive, but perhaps you can do:

var inv_gamma = function (shape, scale) {
  return 1 / gamma(shape, 1 / scale);
};

I'm basing that on one of the laws here:


I'm not 100% sure what I've done is correct, but it seems that something along these lines will likely work.
Reply all
Reply to author
Forward
0 new messages