# ML estimator for chi square distribution

Suppose $Y_i$ has normal distribution with mean $\mu$ and variance $\sigma^2$ then

$$\dfrac{\sum( Y_i - \bar{Y})^2}{\sigma^2} \sim \chi^2(n-1)$$

It's a fact that the the ML estimator ($\sigma_{MLE}^2$) for $\sigma^2$ is $$\dfrac{\sum (Y_i - \bar{Y})^2}{n}.$$

Edited the ML estimator

Can someone please show this, I have no clue how to derive this. I tried setting up the ML equations but it I am getting nowhere from there.

$$\log (L(\sigma^2;y)) = \log[\sum (y_i-\bar{y_i})^2] - \log(\sigma^2)$$

but taking the derivative wrt. $\sigma^2$ of $\log (L(\sigma^2;y))$ will make the first term disappear. After setting the resulting expression to zero, I am left with $-\dfrac{1}{\sigma^2} = 0$.

I must be missing something fundamental.

• You need to divide by by $n-1$ in your estimator of $\sigma^2$ Commented Jul 7, 2017 at 22:57
• To get the MLE for $\sigma^2$ has a factor of 1/n that you are missing. Also deriving the chi square distribution does not require the likelihood equation. Commented Jul 7, 2017 at 22:58
• Does this help? If not, you should edit the question to show what you have tried and where you are stuck. Commented Jul 7, 2017 at 23:01
• @user3164100 the unbiased estimator involves dividing by n-1 but the MLE has the factor 1/n. Commented Jul 7, 2017 at 23:01
• You haven't written the likelihood equation correctly. Look at GeoMAtt22 link and you will see that you need to use the proof of Cochran's theorem and not the likelihood equation which by the way depends on both the parameters $\mu$ and $\sigma^2$. Commented Jul 7, 2017 at 23:47

The problem is that you haven't written down the correct likelihood.

Suppose $X$ is a positive multiple $\theta$ ($=\sigma^2$) of a variable $Y$ with distribution function $F_Y$ and density $f_Y$. To find the density of $X$ itself, resort to the definition of the distribution function:

$$F_X(x) = \Pr(X\le x) = \Pr(\theta Y \le x) = \Pr(Y \le x/\theta) = F_Y\left(\frac{x}{\theta}\right).$$

The density of $X$ therefore is

$$f_X(x) = \frac{d}{dx} F_X(x) = \frac{d}{dx} F_Y\left(\frac{x}{\theta}\right)=\frac{1}{\theta}f_Y\left(\frac{x}{\theta}\right).$$

You mustn't forget the factor of $1/\theta$. Let's see how it works out.

Suppose we observe $X=x$. (In the application, this observation is the statistic $x = \sum_{i=1}^n (y_i-\bar y)^2$ from $n$ iid Normal variates $Y_i$ with realizations $y_i$.) As usual, let's minimize the likelihood by differentiating the logarithm and setting that to zero:

$$0 = \frac{d}{d\theta}\log\left(\frac{1}{\theta} f_Y\left(\frac{x}{\theta}\right)\right)=-\frac{1}{\theta} - \frac{x}{\theta^2} \left(\log f_Y\right)^\prime\left(\frac{x}{\theta}\right).\tag{1}$$

For a $\chi^2(n-1)$ distribution, $$\log(f_Y(y)) = C + \frac{n-3}{2}\log(y) - \frac{y}{2}$$ where $C$ does not depend on $y$. Its derivative is $$(\log f_Y)^\prime(y) = \frac{n-3}{2y} - \frac{1}{2}.\tag{2}$$

Plugging $y=x/\theta$ into $(2)$ and evaluating $(1)$ produces

$$0 = -\frac{1}{\theta} - \frac{x}{\theta^2}\left( \frac{n-3}{2x/\theta} - \frac{1}{2}\right)$$

with the unique solution $$\hat\theta = \frac{x}{n-1} = \frac{\sum_{i=1}^n(y_i-\bar y)^2}{n-1},$$ as claimed.

• How did you get n-1 in the denominator for the MLE for $\sigma^2$ when it should be n? Commented Jul 8, 2017 at 1:47
• That's a good question, @Michael. I think it's because I have taken the approach of the title: namely, to find the MLE for a multiple of a $\chi^2(n-1)$ distribution, rather than to find the MLE for a Normal distribution. The two problems are subtly different. I believe the correct parallel between the two is that this one should be the equivalent of the MLE of a sample of size $n-1$ from a Normal$(\mu,\sigma)$ with $\mu$ known; it's not quite the same thing as the MLE for $\sigma$ of a sample of size $n$ with $\mu$ (and, of course, $\sigma$) unknown.
– whuber
Commented Jul 8, 2017 at 2:07