CONTENTS

Exercise: MLE for a Normal with Unknown Mean and Variance

Problem

Let X1,,XnX_1, \ldots, X_n be i.i.d. N(μ,σ2)\mathcal{N}(\mu, \sigma^2).

  1. Write out the joint log-likelihood (μ,σ2)\ell(\mu, \sigma^2).

  2. Set partial derivatives /μ\partial\ell/\partial\mu and /σ2\partial\ell/\partial\sigma^2 to zero and solve for the MLEs μ^\hat\mu and σ^2\hat\sigma^2.

  3. Compute E[σ^2]\mathbb{E}[\hat\sigma^2] and show that the MLE for variance is biased: E[σ^2]=(n1)σ2/n\mathbb{E}[\hat\sigma^2] = (n-1)\sigma^2/n.
  4. State the bias-corrected (Bessel) version σ^Bessel2=1n1(xixˉ)2\hat\sigma^2_{\text{Bessel}} = \frac{1}{n-1}\sum(x_i - \bar x)^2, which is unbiased.

  5. Numerical simulation. For true μ=0,σ2=1\mu = 0, \sigma^2 = 1, generate m=10,000m = 10{,}000 sample sets of size n=10n = 10. Compute both σ^2\hat\sigma^2 (MLE) and σ^Bessel2\hat\sigma^2_{\text{Bessel}} for each. Report the average of each across the mm experiments and verify they match (n1)/n=0.9(n-1)/n = 0.9 and 11 respectively.

Hint

For part 3: use Var(Xˉ)=σ2/n\text{Var}(\bar X) = \sigma^2/n, so E[(Xˉμ)2]=σ2/n\mathbb{E}[(\bar X - \mu)^2] = \sigma^2/n. Then:

E[(XiXˉ)2]=E[(Xiμ)2]nE[(Xˉμ)2]=nσ2σ2=(n1)σ2.\mathbb{E}\left[\sum(X_i - \bar X)^2\right] = \mathbb{E}\left[\sum(X_i - \mu)^2\right] - n\mathbb{E}[(\bar X - \mu)^2] = n\sigma^2 - \sigma^2 = (n - 1)\sigma^2.
Jump to the solution when you're ready.