Dynamic panels with difference and system GMM

When your model includes a lagged dependent variable, or your regressors are endogenous, fixed effects is biased. GMM is the standard fix in finance, growth and banking dissertations. It is also easy to misuse. Here's how to do it properly.

3 min readReviewed 2026-11-25Stata · R
M

Made for: Master's dissertation student

Your data is ready. The model isn't cooperating.

Sound familiar?

  • The Hausman test says one thing and your supervisor says another
  • Stata or EViews throws errors you can't decode at 1 a.m.
  • You're not sure your results are even the right ones to report
  • The deadline is fixed, and your supervisor has 20 other students

We diagnose your model, run it with you, and explain every number so you can defend it.

When you need GMM

Use dynamic panel GMM when:

  • your model includes yᵢ,ₜ₋₁ (performance, growth, capital structure and bank profitability all tend to persist), and
  • you have many units and few periods (large N, small T, e.g. 200 firms × 8 years), and/or
  • some regressors are endogenous (reverse causality between, say, governance and performance).

With a lagged dependent variable, FE is biased when T is small (Nickell, 1981), and OLS is biased upward. GMM uses internal instruments (lags of the variables) to fix both.

Difference GMM vs system GMM

Difference GMM (Arellano-Bond, 1991) System GMM (Blundell-Bond, 1998)
Equations First-differenced equation Differenced and levels equations together
Instruments Lagged levels for differences Plus lagged differences for levels
Weakness Weak instruments when the series are persistent More instruments; needs an extra stationarity assumption
Typical use Moderately persistent variables Highly persistent variables (ROA, GDP, leverage)

As a rule of thumb, the coefficient on yᵢ,ₜ₋₁ should fall between the FE estimate (biased down) and the pooled OLS estimate (biased up). If your GMM estimate is outside that range, suspect weak instruments.

Step by step in Stata (xtabond2)

xtabond2 is a user-written command by Roodman (2009): ssc install xtabond2.

xtset firm year
xtabond2 roa L.roa leverage size growth i.year, ///
    gmm(L.roa leverage, lag(2 4) collapse)      ///  endogenous
    iv(size growth i.year)                      ///  exogenous
    twostep robust small
  • gmm() lists lagged dependent and endogenous variables; lag(2 .) uses lags 2 and deeper for endogenous variables (lag 1 for predetermined ones).
  • iv() lists strictly exogenous variables and year dummies.
  • twostep robust applies the Windmeijer (2005) finite-sample correction.
  • collapse and limited lags keep the instrument count down.
  • Add noleveleq for difference GMM; the default is system GMM.

The diagnostics examiners check

Test Null hypothesis You want
AR(1) in first differences No first-order serial correlation Usually rejected (p < 0.05). That's expected.
AR(2) in first differences No second-order serial correlation Not rejected (p > 0.05). Essential for valid instruments.
Hansen J Instruments are jointly valid Not rejected, but a p-value close to 1.000 signals too many instruments
Difference-in-Hansen Subsets of instruments are valid (e.g. the levels instruments) Not rejected
Instrument count n/a Below the number of groups (Roodman, 2009)

Report the Hansen test rather than Sargan: Sargan is not robust to heteroskedasticity. Report both if you like, but rely on Hansen.

How to report it

Example: We estimate a two-step system GMM model with Windmeijer-corrected standard errors (Blundell & Bond, 1998; Roodman, 2009). Lagged ROA and leverage are treated as endogenous and instrumented with their second to fourth lags in collapsed form. The AR(2) test (z = 0.84, p = .40) and the Hansen test (χ²(18) = 21.3, p = .26) support instrument validity; 31 instruments are used for 148 firms.

Your table should show coefficients, corrected standard errors, the number of observations, groups and instruments, AR(1), AR(2), Hansen and difference-in-Hansen p-values.

Common mistakes

  • Instrument proliferation. Hundreds of instruments for 100 firms overfit the endogenous variables and weaken the Hansen test (p = 1.000 is a red flag, not a success). Use collapse and limit lags.
  • Using GMM with small N and large T (e.g. 20 countries × 30 years). GMM is designed for large N. With long T, consider FE (Nickell bias shrinks with T), or panel ARDL/PMG.
  • Not reporting how each variable was instrumented. Reviewers need this.
  • Treating everything as exogenous to make the tests pass.
  • Using one-step without robust SEs when errors are heteroskedastic.

Frequently asked questions

Is xtabond in official Stata the same?

xtabond (difference GMM) and xtdpdsys (system GMM) are official commands, but xtabond2 gives you more control over instruments and reports all the diagnostics. Most published papers use xtabond2.

How many lags should I use as instruments?

Start with lags 2–3 or 2–4 for endogenous variables, collapsed, and check robustness to the lag range. Always report the instrument count.

Can I do GMM in R or EViews?

In R, use pgmm() from plm. EViews offers dynamic panel GMM (Arellano-Bond) through its panel GMM estimation options. Stata's xtabond2 remains the most widely used and documented.