# Method of Moments

Suppose $X_1, \dots, X_n$ are iid binomial random variables with parameters $k$ and $p$. So $$P(X_k = k|k,p) = \binom{k}{x}p^{x}(1-p)^{k-x}$$

Here $k$ and $p$ are unknown and we want to find point estimators for them. Why is the second population moment $kp(1-p)+k^{2}p^{2}$? That is, we have:

$$\bar{X} = kp$$ $$\frac{1}{n} \sum X_{i}^{2} = kp(1-p)+k^{2}p^{2}$$

-
Do you mean $P(X_k=x|k,p)$? –  Thomas Andrews Jan 30 '12 at 12:47
You seem to have $k$ and $i$ mixed up: you may want something like $P(X_i = x_i|k,p)$ on the left hand side of your first formula. I also suspect your last two formulae are expectations on the left hand side, i.e. $E\left[ \frac{1}{n} \sum X_i \right]$ and $E\left[ \frac{1}{n} \sum X_i^2 \right]$ –  Henry Jan 30 '12 at 12:48
We can consider each $X_i$ to be distributed as $\sum_{j=0}^k Y_{i,j}$ where each $Y_{i,j}$ is an independent Bernoulli random variable taking the value $1$ with probability $p$ and $0$ with probability $1-p$, and $E[Y_{i,j}]=p$. Similarly $E[Y_{i,j}^2]=p$ and $E[\left(Y_{i,j}-E[Y_{i,j}]\right)^2]=E[Y_{i,j}^2]-E[Y_{i,j}]^2 =p - p^2 = p(1-p)$.
So $E[X_{i}]=\sum_{j=0}^k E[Y_{i,j}]=kp$ and $E[\left(X_{i}-E[X_{i}]\right)^2]=\sum_{j=0}^k E[\left(Y_{i,j}-E[Y_{i,j}]\right)^2]=kp(1-p).$ But $E[X_{i}^2]=E[\left(X_{i}-E[X_{i}]\right)^2] + E[X_{i}]^2 = kp(1-p) + k^2 p^2$, which is really the result you want.
If you need it spelt out $E\left[ \frac{1}{n} \sum_{i=1}^n X_i^2 \right] = \frac{1}{n} E\left[ \sum_{i=1}^n \left(kp(1-p) + k^2 p^2\right) \right] = kp(1-p) + k^2 p^2$.