Simplifying the Gaussian log-likelihood function

Starting from the log-likelihood function for a Gaussian,

$$\mathcal{L}\mathcal{L} = - \frac{N}{2} \log{\left(2 \pi\sigma^2\right)} - \frac{1}{2 \sigma^2} \sum_{i=1}^{N}{{\left(x_i - \mu\right)}^2} \tag{1}$$

if we assume the population to be well-represented by the sample distribution such that $$\sigma^2 = \frac{\sum_{i=1}^{N}{{\left(x_i - \mu\right)}^2}}{N}$$ , can we simplify the term on the right to $$\frac{N}{2}$$, resulting in:

$$\mathcal{L}\mathcal{L} = -\frac{N}{2} \left(\log{\left(2 \pi\sigma^2\right)} + 1 \right) \tag{2}$$

• What exactly are you trying to do here?
– Tim
Dec 12, 2021 at 13:49

Not quite. However, you can set $$\hat\mu=\bar x$$, and $$\hat \sigma^2 = \frac{1}{N}\sum_i (x_i-\hat\mu)^2$$ to get the profile likelihood
$$\ell = -\frac{N}{2}\left(\log(2\pi\hat\sigma^2)+1\right)$$
This is useful for comparing different models. A similar approach is useful in fitting mixed models, where the profile likelihood with $$\mu$$ and $$\sigma$$ profiled out still depends on the other variance parameters.
You can't write $$\ell(\sigma^2) = -\frac{N}{2}\left(\log(2\pi\sigma^2)+1\right)$$ because that's only a good approximation if $$\sigma^2\approx\hat\sigma^2$$; it's not a good approximation as $$\sigma^2$$ varies.