RainbowStats ยท Econometric commands
GMM
Two-step linear IV-GMM with Bartlett-kernel Newey-West HAC inference and an educational slideshow.
Syntax
GMM(y,LIST(x1,x2,...),LIST(z1,z2,...))
GMM(y,LIST(x1,x2,...),LIST(z1,z2,...),hacLags)Omitting hacLags chooses floor(4*(n/100)^(2/9)); 0 gives heteroskedasticity-only inference. Positive integers specify the number of autocovariance lags. The intercept is included in both X and Z automatically. The sample is aligned by date.
Example
Y=UNRATE
X=FEDFUNDS
Z1=GS10
Z2=T10Y3M
Model=GMM(Y,LIST(X),LIST(Z1,Z2),12)
slide(Model)
EXTRACT(Model,"j_test")For monthly observations, 12 HAC lags covers one year of serial correlation. This is a software demonstration, not a claim that the yields are valid instruments.
Interpretation
Uses first-step Z'Z weighting, then the Bartlett-weighted long-run covariance of centered moment vectors g(t)=z(t)*e(t) to obtain second-step coefficients and HAC sandwich standard errors. In overidentified systems, Hansen J = n*gbar'W*gbar uses the second-step weighting matrix and asymptotic chi-square degrees of freedom equal to instruments minus coefficients. HAC can change both uncertainty and J-test conclusions.
Weak instruments, invalid exclusion restrictions, and structural breaks remain concerns. The command does not implement cluster-robust inference, nonlinear GMM, or dynamic-panel GMM.
Extracts
slideshow, summary, coefficients, diagnostics, j_test, fitted, residuals.
Available extracts
Save the command result in a variable, then use EXTRACT(result, "key"). Availability can depend on the input form and fitted model.
slideshowsummarycoefficientsdiagnosticsj_testfittedresiduals
In indexed patterns such as beta:n, replace n with the required index.