I'm doing a question from a Bayesian stats textbook for study and am a bit confused with the result. Pretty sure I've messed something up but I'm not sure exactly what is going on here so any help is much appreciated.
QUESTION: A random sample of $25$ observations is obtained from a normal distribution with $\mu$ unknown and a known variance of $\sigma^2=1$. The sample mean is found to be $0.29$. Given that $\mu>0$, use a flat prior to determine the posterior. Plot this posterior and determine a $95\%$ highest posterior density (HPD) interval for $\mu$.
My attempt: The bayesian posterior here (with sample mean $y=0.29$, and utilising a flat prior) is given by $$\mu|\mathbf{y}, \sigma^2 \sim N\bigg(\overline{y},\frac{\sigma^2 }{n}\bigg)$$
We known $n=25$ and $\sigma^2=1$, so the posterior is
$$\mu|\mathbf{y} \sim N\bigg(0.29,\frac{1}{25}\bigg) = N\big(0.29,0.04\big).$$
Then the plot of the distribution looks like this: Plot of posterior
We see that the posterior is symmetric and unimodal, and so the $95\%$ HPD interval should just be the regular $95\%$ CI of $(0.2116, 0.3684)$, right? Something seems wrong here because I don't see why the question would be asking for a HPD interval if this was actually the case...
Your procedure is correct, but:
I amended your notation of $\mu|\mathbf{y}$; I understood what you meant but your notation was wrong.
the result you found is incorrect:
$$\overline{y}-1.96\times \frac{\sigma}{\sqrt{n}}\leq\mu\leq \overline{y}-1.96\times \frac{\sigma}{\sqrt{n}}$$
$$0.29-1.96\times \frac{1}{5}\leq\mu\leq 0.29-1.96\times \frac{1}{5}$$
...you wrongly considered $\frac{1}{25}$ instead of $\frac{1}{\sqrt{25}}$
Finally: Bayesian CI can be calculated in several ways, Centered Intervals or HPD.
The fact that, in this particular case, they are the same it is not significant.