I am working on a project where I believe Bayesian statistics should be useful. However, my knowledge about Bayesian statistics are very scarce. Suppose I got data following a Gamma distribution with a known shape-parameters of $\alpha = 11.26$ and the estimated parameters for the prior are, $a=1.08$ and $b=13.7$ (a being shape and b being rate).

For the prior I got a Gamma distribution: $$ f(\theta) = \frac{b^{a}}{Γ(a)} \theta^{a-1} \exp(-b\theta) $$

And the likelihood: $$ L(x|\theta) = \prod_{i=1}^{n}\frac{\beta^{\alpha}}{\Gamma(\alpha)}\theta^{\alpha} \exp(-\theta x_i) = \frac{\beta^{\alpha n}}{\Gamma(\alpha)}\theta^{\alpha n}\exp\left(-\theta \sum_{i=1}^{n}x_i\right) $$

Thus the posterior is: $$ f(\theta|x) ∝ \theta^{a-1} \exp(-b\theta) * \theta^{\alpha} \exp(-\theta \sum_{i=1}^{n}x_i) = \theta^{a+\alpha n - 1} \exp(-\theta(b + \sum_{i=1}^{n}x_i) $$

This will then be a $Ga(a+\alpha n, b + \sum_{i=1}^{n}x_i)$ am I right?

However, when I plug in the values for $(a+\alpha n, b + \sum_{i=1}^{n}x_i)$, I get a distribution that is not possible/true. The posterior distribution will be $Ga(1250.94, 17.39)$,the plotted distribution moves very far away from both the data and prior, the distribution should be closer to the data rather than be further away?

Is the posterior parameters not the distribution or have I misunderstood something? Or is it possible that it is not at all a probability density function I am plotting?

  • 1
    $\begingroup$ The likelihood is a function of the parameter given the data: $L(\theta|x)$. Is the likelihood gamma as well? Then you got the formula wrong. Take a look at Wikipedia as well. $\endgroup$
    – dipetkov
    Commented Jul 15, 2022 at 23:32
  • $\begingroup$ The posterior you're looking at is a distribution for $\theta$, not $x$. $\endgroup$
    – Glen_b
    Commented Apr 10 at 0:22

1 Answer 1


If $X_i|\theta\sim\mathcal G(\alpha,\theta)$ for $1\le i\le n$, and $\theta$ is the rate parameter of the Gamma, the likelihood is $$L(\theta|\mathbf x)=\prod_{i=1}^n x_i^{\alpha-1}\Gamma(\alpha)^{-n}\theta^{\alpha n}\exp\{-\theta n\bar x_n\}\propto \theta^{\alpha n}\exp\{-\theta n\bar x_n\}$$ and the associated posterior is indeed $$\theta|\mathbf x \sim \mathcal G(a+\alpha n,b+n\bar x_n)$$ with mean $$\mathbb E[\theta|\mathbf x]=\dfrac{a+\alpha n}{b+n\bar x_n}$$ It is difficult to understand what you mean by

a distribution that is not possible/true

  • 1
    $\begingroup$ Oh just so I get this, the posterior parameters are the ”distribution” for my rate parameter and not a probability density function for the with knowledge of the prior and likelihood if you know what I mean.. That’s why my answer are ”false”/not possible. I’ve missunderstood my answer $\endgroup$
    – alaj1716
    Commented Jul 16, 2022 at 16:56
  • $\begingroup$ Do you mean you've misunderstood your question OR my answer?! $\endgroup$
    – Xi'an
    Commented Jul 16, 2022 at 17:15
  • 1
    $\begingroup$ Missunderstood my result I mean, sorry for my poor english… Thanks for your answer :) $\endgroup$
    – alaj1716
    Commented Jul 16, 2022 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.