# Conjugate Prior for Gamma Distribution

This is very basic, but I have been stuck on this problem for a while. Suppose $$Y_1, \dots, Y_n|\alpha,\beta\sim Gamma(\alpha, \beta)$$ is iid with $$\alpha$$ known. I want conjugate prior for $$\beta$$ and the posterior.

My work:

$$p(\beta|y_1, \dots, y_n)=p(y_1, \dots, y_n|\beta)p(\beta)=(\prod_{i=1}^{n} y_i)^{\alpha-1} \exp(-\beta\sum_{i} y_i) p(\beta)$$

$$\propto \exp(-\beta\sum_{i} y_i) p(\beta)$$.

Therefore, the conjugate prior for $$\beta$$ would be gamma$$(\alpha_0, \beta_0)$$.

In this case, we can derive the posterior as:

$$p(\beta|y_1,\dots, y_n)\propto \beta^{\alpha_0 -1} \exp(-\beta(\sum_{i} y_i+\beta_0))$$.

So, the posterior is gamma$$(\alpha_0 , \sum_{i} y_i+\beta_0)$$.

However, Wikipedia says the posterior should be gamma$$(\alpha_0 +n\alpha, \sum_{i} y_i+\beta_0)$$. I don't understand where does $$n\alpha$$ come from. I also don't understand why my derivation is not correct. Thanks in advance!

• The density of a Gamma distribution with parameters $$\alpha$$ and $$\beta$$ is $$\frac{1}{\Gamma(\alpha)}\beta^{\alpha }y^{\alpha-1}\exp(-\beta y)$$ when $$y \gt 0$$
• so the likelihood for the observations here is proportional (with terms involving $$\beta$$) to $$\beta^{\alpha n}\exp\left(-\beta \sum_{i=1}^{n} y_i\right)$$
• while your prior for $$\beta$$ is proportional (with terms involving $$\beta$$) to $$\beta^{\alpha_0-1}\exp(-\beta_0 \beta)$$
• so the posterior for $$\beta$$ is proportional to $$\beta^{\alpha_0+\alpha n-1}\exp\left(-\beta\left(\beta_0+\sum_{i=1}^{n} y_i\right)\right)$$
which is proportional to the density of a Gamma distribution with parameters $$\alpha_0+\alpha n$$ and $$\beta_0+\sum_{i=1}^{n} y_i$$