A recent posting reported inconsistencies in ivgmm0 (Baum and Drukker)
in terms of that routine being unable to match official ivreg or ivreg2
(Baum, Schaffer, Stillman) for an exactly-identified equation. Such an
equation, estimated by GMM, should match IV regression results with a
J-statistic of zero. In this peculiar case, the equation had only one
(endogenous) regressor and one instrument, with no constant term. Both
ivreg and ivreg2 will exclude the constant from both the regressor list
and instrument list in that case. ivgmm0 was doing the former but not
the latter. The corrected version, available from SSC, handles this
case properly. The output matches ivreg2 perfectly, and matches ivreg
but for standard errors (which have an n-k divisor in ivreg, but a
divisor of n in ivgmm0).
Thanks to Mark Schaffer for helping locate the bug.