Bayesian inference with conjugate priors - triplot

I'm trying to make a "triplot" to illustrate Bayesian inference (so I'd like to have prior, likelihood and posterior in the same picture). For likelihood I'm using $$\label{eq:lik} f(y|\tau) = \prod_{i=1}^{n}\frac{\tau}{\sqrt{2\pi}}\exp\left(-\frac{\tau(y_{i}-\mu)^{2}}{2}\right) = \frac{\tau}{\sqrt{2\pi}}\exp\left(-\frac{\tau\sum_{i=1}^{n}(y_{i}-\mu)^{2}}{2}\right),$$ i.e., the Gaussian distribution with known mean $\mu$ and unknown precision $\tau=\frac{1}{\sigma}$, where ${\sigma}^{2}$ is the unknown variance.
If we choose the prior on $\tau$ to be a gamma distribution $$p(\tau)=\Gamma(\alpha,\beta),$$ with the shape $\alpha$ and the rate $\beta$, we can use the conjugacy theory to find the form of the posterior. The posterior distribution in our example is the following gamma distribution $$p(\tau|y)=\Gamma\left(\alpha+\frac{n}{2},\beta+\frac{\sum_{i=1}^{n}(y_{i}-\mu)^{2}}{2}\right).$$ I plotted it with $\alpha=1.5$, $\beta=10.0$, $\mu=0.0$ $n=5$ and the random sample $(y_i)_{i=1\dots 5}$ was generated assuming the "true" value of $\tau=0{.}25$. As you can see, the likelihood is not visible. I tried different configurations of parameters but nothing helped.
I'd be very grateful for any ideas how to choose $\alpha$ and $\beta$ so that I get a nice illustration, something like that.

• Hint: normal distribution does not range from 0 to 2, but can take also negative values. Hight of densities can also vary for different distributions. – Tim Aug 24 '16 at 10:02
• @Tim, I'm aware of that. I chose (0,2) "just because" but I tried different axes. I know the hight varies but whatever I try, prior and posterior are much "higher" than the likelihood. This is why I asked for help. – Paula Aug 24 '16 at 10:06
• ...and they will be. If it's just for illustration purpose then you can simply multiply the likelihood by some arbitrary constant to "look nice". – Tim Aug 24 '16 at 10:09
• Imagine that you plotted three continuous uniform distributions with ranges 1, 50, and 5000, they will have heights 1, 1/50 and 1/5000 -- this is how densities work, so if you want them to have "similar" heights then you need to rescale them. – Tim Aug 24 '16 at 10:16
• The likelihood is not a density in the parameter and the likelihood principle tells you it is defined up to a constant. Renormalising it is thus not cheating! – Xi'an Aug 25 '16 at 3:14

1 Answer

The method is very easy: I'll rescale the likelihood which is fine because it doesn't have to integrate to 1.