### Method of moments

The expressions on the right are sample moments and on the left are parameters of a distribution (in terms of moments of the distribution).

$$\begin{array}{ccl}
\overbrace{\mu}^{\substack{\text{parameters of}\\\text{population distribution}\\\text{in terms of moments}}} &=& \overbrace{\frac{1}{N}\sum_{i=1}^N{x_i}}^{\text{sample moments}}\\
\sigma^2 &=& \frac{1}{N}\sum_{i=1}^N{(x_i-\mu)^2}
\end{array}$$

Whenever you are setting these two equal then you are employing the [method of moments](https://en.m.wikipedia.org/wiki/Method_of_moments_(statistics)).

You can use this method also when you are not dealing with a normal distribution.

### Example: betabinomial distribution

Say we have a population that follows a betabinomial distribution with a fixed size parameter $n$ and unknown parameters $\alpha$ and $\beta$. For [this case](https://en.m.wikipedia.org/wiki/Beta-binomial_distribution#Method_of_moments) we can also parameterize the distribution in terms of the mean and variance 

$$\begin{array}{rcl}
\frac{n \alpha}{\alpha + \beta} &=& \mu\\
\frac{n\alpha\beta(n+\alpha+\beta)}{(\alpha +\beta)^2(\alpha+\beta+1)} &=& \sigma^2
\end{array}$$

and set it equal to the sample moments

$$\begin{array}{rcccccl}
\frac{n \hat\alpha}{\hat\alpha + \hat\beta}&=& \hat{\mu} &=& \bar{x} &=&\frac{1}{N}\sum_{i=1}^N{x_i}\\
\frac{n\hat\alpha\hat\beta(n+\hat\alpha+\hat\beta)}{(\hat\alpha +\hat\beta)^2(\hat\alpha+\hat\beta+1)}&=& \hat{\sigma}^2 &=& s^2 &=&\frac{1}{N}\sum_{i=1}^N{(x_i-\bar{x})^2} 
\end{array}$$

From which estimates for the distribution follow

$$\begin{array}{rcl}
\hat\alpha &=& \frac{ n\hat{x}-s^2-\hat{x}^2 }{n ( \frac {s^2}{\hat{x}}-1 ) +\hat{x}} \\
\hat\beta &=&\frac{( n-\hat{x} )  ( n-{\frac {s^2+\hat{x}^2}{\hat{x}}}
 )}{n ( \frac {s^2}{\hat{x}}-1 ) +\hat{x}}
\end{array}$$

With the above estimates $\hat{alpha}$ and $\hat{beta}$ the estimated population has the same mean and variance as the sample.

### Note

In the case of estimating the parameters of a normal distribution, then the method of moments coincides with the maximum likelihood method.