The full academy launches January 2027. Join the waitlist for the $179 founding price.
Waldbauer Academy of Economics

Courses › Graduate Econometrics

Graduate · Module 7 of 15

The generalized method of moments

Moment conditions as a unifying idea, the GMM estimator and its asymptotic distribution, the optimal weighting matrix, two-step and iterated GMM, Hansen’s J test, and nonlinear moment models.

By Maximus S. Waldbauer · About 5 to 6 hours, including the problem set and quiz.

Many estimators you already know solve an equation of the form “sample average of something = 0”. The sample mean solves (1/n)Σ(yi − μ) = 0. OLS solves (1/n)Σxi(yi − xi′β) = 0. The MLE solves (1/n)Σsi(θ) = 0. The generalized method of moments (GMM), introduced by Hansen (1982), takes this idea as the starting point and asks what to do when economic theory gives us more such equations than unknowns.

GMM is the workhorse for models where a full likelihood is unavailable or not credible but theory still delivers conditions that should hold on average: instrumental variables (Module 8), dynamic panels (Module 10), Euler equations in macroeconomics and finance. This module covers the estimator, its asymptotic distribution, optimal weighting, Hansen’s J test of overidentifying restrictions, and the practical problems that come with estimated weights.

By the end of this module you will be able to

What this module covers

  1. Moment conditions
  2. The GMM estimator
  3. Optimal weighting and two-step GMM
  4. Testing overidentifying restrictions
  5. GMM in practice
  6. Problem set with step-by-step solutions
  7. Module quiz

Lesson 7.1 Free lesson

Moment conditions

A moment condition is a function g(w, θ) of the data w and parameters θ (with k elements) that has mean zero at the true value:

E[g(wi, θ0)] = 0

If there are exactly k moment conditions, the method of moments (MM) sets the sample averages to zero and solves: ḡ(θ̂) = (1/n)Σg(wi, θ̂) = 0. Many estimators fit this mould:

EstimatorMoment condition g(w, θ)Source of the condition
Sample meany − μDefinition of the mean
OLSx(y − x′β)Best linear predictor: E[xu] = 0
Instrumental variablesz(y − x′β)Instrument uncorrelated with the structural error
Maximum likelihood∂ ln f(y; θ)/∂θThe score has mean zero (Module 6)
Consumption Euler equationβ(1 + rt+1)(ct+1/ct)−γ − 1Optimal saving: rational forecast errors average zero

The last row is the case that motivated GMM. The consumption Euler equation says that, for an optimizing household, the discounted marginal-utility-weighted return on saving equals one in expectation given today’s information. Any variable zt known today must then be uncorrelated with the forecast error, so E[zt(β(1 + rt+1)(ct+1/ct)−γ − 1)] = 0 for every such zt. Theory supplies as many moment conditions as we like, with no need to specify the distribution of consumption or returns (Hansen and Singleton, 1982).

Worked example: Two ways to estimate a mean wait

If café waits are exponential with mean θ, two moment conditions hold: E[y − θ] = 0 and E[y2 − 2θ2] = 0 (an exponential’s variance equals its squared mean).

In a sample with ȳ = 4.2 and mean of y2 equal to 36, the first condition gives θ̂ = 4.2 and the second gives θ̂ = √(36/2) ≈ 4.24.

Each is a valid method-of-moments estimator. With two conditions and one unknown, we cannot set both sample moments to zero at once. GMM tells us how to combine them.

Key ideas

  • A moment condition E[g(w, θ0)] = 0 is all GMM needs: no full distribution.
  • Mean, OLS, IV and MLE are all method-of-moments estimators.
  • Rational-expectations Euler equations generate moment conditions for any variable in the information set.

Practice questions: The generalized method of moments

Try these, then open each answer to check your work.

  1. 1.Which moment condition defines the simple instrumental variables estimator?
    1. E[x(y − x′β)] = 0
    2. E[y − x′β] = 0 alone
    3. E[z(y − x′β)] = 0
    4. E[zx′] = 0
    Show answer

    Answer: C. IV sets the sample covariance between the instruments and the structural residual to zero. E[x(y − x′β)] = 0 defines OLS, and E[zx′] = 0 would mean the instrument is irrelevant.

  2. 2.In GMM with m moment conditions and k parameters, the model is overidentified when
    1. m < k
    2. m = k
    3. m > k
    4. the weighting matrix is the identity
    Show answer

    Answer: C. Overidentification means more moment conditions than parameters.

  3. 3.The asymptotically efficient GMM weighting matrix is
    1. the inverse of the variance of the moments, S−1
    2. the identity matrix, weighting moments equally
    3. (X′X)−1, as in two-stage least squares
    4. the Hessian of the GMM objective function
    Show answer

    Answer: A. W = S−1 gives variance (G′S−1G)−1, the smallest among GMM weightings.

Problems with step-by-step solutions

  1. 4.Write OLS as a method-of-moments estimator and solve the sample moment condition.
    Show step-by-step solution
    1. Moment condition: E[x(y − x′β)] = 0.
    2. Sample analogue: (1/n)Σxi(yi − xi′β̂) = 0 ⇒ X′Xβ̂ = X′y ⇒ β̂ = (X′X)−1X′y.
  2. 5.A Poisson count has E[y] = λ and Var(y) = λ. Write two moment conditions for λ, and the method-of-moments estimates in a sample with ȳ = 3 and sample variance 4.5.
    Show step-by-step solution
    1. g1 = y − λ; g2 = (y − λ)2 − λ.
    2. From g1: λ̂ = 3. From g2 alone (with the sample variance): λ̂ = 4.5.
    3. The two disagree, a sign of overdispersion that a J test would formalize.

Get the full module

The complete module adds every lesson, interactive graphs, a full problem set with step-by-step solutions, and a quiz. The academy opens in January 2027: join the waitlist for the founding price (lifetime access for $179).

Join the waitlist Try a full module free

More practice: free practice questions for this course.