Log of the Gaussian data likelihood

58 Views Asked by At

Given that the model distributon is Gaussian with known variance $\sigma^2 = 1$

$$ p(x_i | \mu, \sigma^2=1) = \mathcal{N}(x_i | \mu, 1) = \frac{1}{\sqrt{2\pi}}\exp{-\frac{(x_i - \mu)^2}{2}} ,$$

the log of the data likelihood $\mathcal{D} = \{x_0,x_1,\dots, x_n \}$ can be expressed as function of $\mu$ as following: $$ \ln{p(D|\mu)} = -\frac{1}{2}\Big(- 2\sum_{i=1}^N x_i\mu + N\mu^2 \Big) + \text{const}$$

where $\text{const}$ utilizes all of the term which do not depend on $\mu$.

How do we formally prove this equality?

1

There are 1 best solutions below

0
On BEST ANSWER

\begin{align} \log p(D \mid \mu) &= \log \prod_{i=1}^n p(x_i \mid \mu) \\ &= \sum_{i=1}^n \log p(x_i \mid \mu) \\ &= \sum_{i=1}^n \left(-\frac{1}{2} \log(2\pi) - \frac{1}{2} (x_i - \mu)^2\right)\\ &= \text{const} - \frac{1}{2} \sum_{i=1}^n (x_i-\mu)^2 \\ &= \text{const} - \frac{1}{2} \sum_{i=1}^n (x_i^2 - 2 x_i \mu + \mu^2) \\ &= \text{const} - \frac{1}{2} \left(n\mu^2 - 2 \mu\sum_{i=1}^n x_i\right) \end{align}