On this page
You have a sample and a distribution with an unknown parameter. The method of moments pins that parameter down with nothing beyond averages and algebra. Here are two worked examples, a comparison with maximum likelihood, and the cases where it gives an answer your own data rules out.
What is the method of moments?
The k-th population moment is E[X^k], and the k-th sample moment is the average of x_i^k over your n observations, as defined in MIT 18.443's lecture notes on parameter estimation. The method of moments sets the population moments, written as functions of the parameters, equal to the sample moments and solves the resulting equations for the parameters.
The recipe has three steps:
Count the unknown parameters; you need one equation for each.
Write the first few theoretical moments, E[X] and E[X²], in terms of the parameters.
Set each equal to its sample moment and solve.
If moments still feel slippery, our explainer on moment generating functions and how they give the mean and variance shows where E[X] and E[X²] come from.
How do you find the method of moments estimator for uniform(0, θ)?
One parameter, one equation. For X uniform on (0, θ), E[X] = θ/2, so setting θ/2 equal to the sample mean x̄ gives θ̂ = 2x̄, the worked result in Macalester's MATH/STAT 355 notes on the method of moments. The intuition: a uniform sample's average sits near the middle of the interval, so doubling it should land near the right end.
Take the six observations used in the US Air Force Academy probability and statistics solutions manual, chapter 17: 0.2, 0.9, 1.9, 2.2, 4.7, 5.1. Their sum is 15, so x̄ = 2.5 and θ̂ = 5.
Method of moments or maximum likelihood: which is better here?
Maximum likelihood picks the θ that makes the observed data most probable. For uniform(0, θ) the likelihood is (1/θ)^n when θ is at least as big as every observation and zero otherwise, so it peaks at the smallest allowed θ: the sample maximum, which the same USAFA manual derives. On our data that is 5.1.
Now compare. The method of moments says θ = 5, yet one observation is 5.1. A uniform(0, 5) variable can never exceed 5, so the estimate is impossible; the manual says so and notes that the maximum likelihood estimate is always feasible. This is common: in the manual's simulation with samples of 10 and 10,000 repetitions, 2x̄ fell below the sample maximum in about 28.5% of samples.
2x̄ weights every point equally, so its variance is 4 × (θ²/12)/n = θ²/(3n), by the rule in our post on how to find the variance of a sum of random variables. The maximum uses only the largest point, which is where the information about θ sits. More generally, moment estimators are not asymptotically efficient, unlike maximum likelihood estimators, according to the Wikipedia article on the method of moments).
How do you estimate a gamma distribution by the method of moments?
Two parameters need two equations. For Gamma(α, λ) with shape α and rate λ, E[X] = α/λ and Var(X) = α/λ², and the MIT 18.443 slides solve these to get λ̂ = x̄/σ̂² and α̂ = x̄²/σ̂², where σ̂² is the average squared deviation from x̄ (divide by n, not n − 1).
Worked example. Suppose you time eight waits at a bus stop, in minutes: 2, 3, 1, 6, 3, 4, 2, 3.
x̄ = 24/8 = 3.
Deviations from 3 are −1, 0, −2, 3, 0, 1, −1, 0. Their squares add to 16, so σ̂² = 16/8 = 2.
α̂ = 3²/2 = 4.5 and λ̂ = 3/2 = 1.5 per minute.
Check: α̂/λ̂ = 3 matches the mean, and α̂/λ̂² = 2 matches the variance.
The Macalester notes point out that maximum likelihood estimates can need numerical optimisation, while the method of moments often gives a closed form, as it did here.
When does the method of moments give impossible estimates?
The algebra always runs; the answer does not always make sense. Watch for these cases, each documented in the Wikipedia article on the method of moments):
The fitted range excludes your data. Fitting uniform(a, b) to the sample 0, 0, 0, 0, 1 with two moments gives b̂ of about 0.89, below the observed 1.
A parameter comes out negative. For a binomial with both n and p unknown, both moment estimators can come out negative, which no binomial allows.
There is no solution. The moment equations do not always have one, and then the method gives no estimator at all.
A practical rule: use the moment estimate as a fast first answer, check it against your data, and switch to maximum likelihood when it fails.
If expectation and variance are the weak link, the Fermi Concept Library gives every concept in mathematics its own lesson. To practise derivations like these, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.



