# How do I sample from the posterior distribution with gamma likelihood with unknown alpha and beta?

I realize that this Wikipedia page provides the proportional form of the conjugate prior to the gamma distribution with unknown $\alpha$ and $\beta$ parameters, as well as the posterior values of $p$, $q$, $r$, and $s$, which are the hyperparameters of the gamma likelihood (see the last distribution in the table under "Continuous distributions"). I do not, however, know how in practice to sample from the conjugate prior to the Gamma with unknown $\alpha$ and $\beta$ parameters. Could I get some pointers? Thank you.

• "In practice" you would be sampling from the posterior, which is a Gamma. Are you asking how to sample a Gamma variate? – whuber Sep 4 '13 at 18:22
• As far as I understand, the conjugate prior to a Gamma distribution with unknown alpha and beta is NOT a Gamma distribution (although the conjugate prior to a Gamma distribution with unknown alpha but known beta is). I am asking how to sample from the non-standard conjugate prior to the Gamma distribution with unknown alpha and beta, which is available on the Wikipedia page I linked to under "Continuous distributions", and it is the last distribution in the table. – Brash Equilibrium Sep 4 '13 at 18:26
• Thank you (+1): could you please edit your question to remove the ambiguous language? (The reference of "this distribution" could either be the Gamma or its conjugate prior.) – whuber Sep 4 '13 at 18:29
• There you go, @whuber – Brash Equilibrium Sep 4 '13 at 18:32
• @Brash have you tried rejection sampling or importance sampling or some sort of MCMC method like Metropolis-Hastings? – user25658 Sep 5 '13 at 5:28