Given a model where $ x_i | \mu \sim \mathcal{N} ( \mu, \sigma^2 ) $ where $ \mu \sim \mathcal{N} ( \mu_0, \sigma_0^2 ) $, is there a closed form formula for the PDF of $ x_i $? Namely, what's $ p (x_i) $?

I know the solution by Bayes, but I wonder if there is a closed form solution.

My intuition is a Normal distribution with updated mean and variance according to the prior.

## Best Answer

One way to model this would be by a sum of 2 variables:

$$ {x}_{i} = {y}_{i} + {z}_{i}, \quad {y}_{i} \sim \mathcal{N} \left( 0, {\sigma}_{2}^{2} \right), \; {z}_{i} \sim \mathcal{N} \left( {\mu}_{0}, {\sigma}_{0}^{2} \right) $$

Since $ {z}_{i} \perp {y}_{i} $ then the variance of $ {x}_{i} $ is the sum of variances.

Hence $ {x}_{i} \sim \mathcal{N} \left( {\mu}_{0}, {\sigma}^{2} + {\sigma}_{0}^{2} \right) $.