# Finding posterior distribution, for gamma prior, and gamma sampling distribution with known shape parameter

Let $\{y_i:i=1,...n\}$ be a random sample from $Ga(\theta,2)$, and the prior for $\theta$ is also from a $Ga(\bar{\theta},\nu)$. I'm using the $scale=\theta$, $shape=2$ parametrization.

$f(y_i|\theta,2)=\frac{1}{\Gamma(2)\theta^2}y_i^{2-1}e^{-y_i/\theta}$, for $y_i>0$.

I'm trying to find the posterior density $f(\theta|y)$. However, what I get is $f(\theta|y) \propto \theta^{\nu -2n-1}\ e^{-\sum y_i /\theta - \theta/\bar{\theta}}$.

I know that this is supposed to be a gamma, but I do not see how I can work with the power of the exponential to get what we need for it to be a gamma...

EDIT: If I use the rate/shape parametrization, $f(y_i|\theta,2)=\frac{\theta^2}{\Gamma(2)}y_i^{2-1}e^{-y_i\theta}$, I can easily get a posterior gamma. This seems to be dependent on the parametrization ?!

• Why do you think it should be another Gamma? According to wikipedia the Gamma distribution is the conjugate prior when you know the shape parameter, not the rate parameter. Here is a link to the wiki table: en.wikipedia.org/wiki/Conjugate_prior Feb 20, 2016 at 16:22
• So in your case, it wont be another Gamma distribution. Just some unknown distribution. Feb 20, 2016 at 16:23
• Sorry I just re-read your title. So you are assuming in the title that you know the shape parameter, however, the way you question in written indicates that you don't know the shape parameter, but rather, you know the rate parameter. I.e., in your problem, your rate is $\theta$ and the shape is 2. Maybe you have those switched? Feb 20, 2016 at 16:26
• @Xi'an Thanks for your comment. You speak of scale, but according to wiki you're writing the densities in the shape/rate parametrization. No? Feb 20, 2016 at 19:00
• @RustyStatistician I've edited the question. I hope it's clearer. Feb 20, 2016 at 19:04

This issue is connected with the two ways of parametrising the second parameter θ of a Gamma $\mathcal{G}(\nu,\theta)$ distribution, scale versus rate.
If the rate θ is unknown, and if you have a sampling density of the form $$f(x|θ,ν)=\dfrac{θ^νx^{ν−1}}{Γ(ν)}\exp\{−θx\}\,,$$ the conjugate prior is $\theta\sim\mathcal{G}(\alpha,\beta)$ with posterior $$\theta|x\sim \mathcal{G}(\alpha+\nu,\beta+x)$$
Or the scale $\theta$ is unknown, with sampling density of the form $$f(x|θ,ν)=\dfrac{θ^{-ν}x^{ν−1}}{Γ(ν)}\exp\{−x/θ\}$$ then the conjugate prior is inverse Gamma, meaning that $\theta^{-1}$ is a $\mathcal{G}(\alpha,\beta)$ variable. The posterior is then again an inverse Gamma, with parameters $\alpha+\nu$ and $\beta+x$, exactly as above! Which makes perfect sense when realising this is just a matter of reparameterisation!
• @Xian, thx for the answer. Just to make sure, in the posterior distribution you've mentioned $$\theta|x \sim Gamma(\alpha + \nu, \beta+x)$$ $\beta$ is the #of samples, and $\alpha = \Sigma_i x_i$ correct? If so, what bothers me is that the hyper parameters of the posterior are growing indefinitely. Since I'm repeatedly calculating the posterior distribution for every evidence batch, I would like to normalize my hyper parameters. How do you I do that? Thx, Elior. Oct 31, 2018 at 7:13