So today in my statistical inference class the professor wrote on the board:
Using the Method of Moments:
$$\sigma^2 = E[Y_1^2|\theta] - E[Y_1|\theta]^2$$ $$= \frac{1}{n}\sum_{j = 1}^{n}{Y_j^2} - \left( \frac{1}{n}\sum_{j = 1}^{n}{Y_j}\right)^2$$ $$= \frac{1}{n}\sum_{j = 1}^{n}{\left( Y_j - \bar{Y}\right)^2 }$$
where $\bar{Y} = \frac{1}{n}\sum_{j = 1}^{n}Y_j$(average values of Y's)
I am confused at how he arrived at the last equation from the one above that and I've been trying to figure it out.
Here's what I have so far:
$$= \frac{1}{n}\sum_{j = 1}^{n}{Y_j^2} - \left( \frac{1}{n}\sum_{j = 1}^{n}{Y_j}\right)^2$$ $$ = \frac{1}{n}\sum_{j = 1}^{n}{Y_j^2} - \frac{1}{n^2}\left(n\bar Y\right)^2$$ $$ = \frac{1}{n}\sum_{j = 1}^{n}{Y_j^2} - \bar Y^2$$
Which is fundamentally different that the equation that my professor had on the board. My equation takes the difference of squares while his takes the square of a difference and then sums those up...
Where did I go so wrong? Is there just some statistical insight that I don't know and haven't used?
Perhaps it's easier to go the other way around. Let $S^2$ be the sample variance and note
\begin{align*} S^2 &= \frac{1}{n}\sum_{j=1}^n(Y_j-\bar Y)^2 \\ &= \frac{1}{n}\sum_{j=1}^n(Y_j^2-2\bar Y Y_j + \bar Y^2)\\ &= \frac{1}{n}\left(\sum_{j=1}^nY_j^2-2\bar Y \left(\sum_{j=1}^n Y_j\right) + n\bar Y^2\right)\\ &= \frac{1}{n}\left(\sum_{j=1}^nY_j^2-2\bar Y (n \bar Y) + n\bar Y^2\right)\\ & = \frac{1}{n}\sum_{j=1}^nY_j^2 - \bar Y^2. \end{align*}
Essentially the Method of Moments here is suggesting to estimate $\sigma^2$ by $S^2$, where the two population moments $E(Y_1^2|\theta),E(Y_1|\theta)$ are replaced by the corresponding sample moments.