Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: gmm moment evaluator program for system of equations

From   Stefano Verde <>
Subject   st: gmm moment evaluator program for system of equations
Date   Tue, 28 Sep 2010 14:42:27 +0100

Dear statalisters,

I've estimated a QUAIDS model using -nlsur-. Now I want to test if
total expenditure is exogenous. So, I need to perform a Hausman type
test. I would say (but I might be wrong!) that the best way is to
estimate the system by -gmm-. Yet, this would require to write a
"moment evaluator program" which I'm not sure how should exactly be.

On the Stata help, I've found an example of moment evaluator program
for a single equation model (reported below). I'm not sure how I
should adapt it to the QUAIDS, which is a (nonlinear) system of

Any help would be greatly appreciated

Stefano Verde

program gmm_ivreg
version 11
syntax varlist [if], at(name) rhs(varlist) depvar(varlist)
tempvar m
quietly gen double `m' = 0 `if'
local i 1
foreach var of varlist `rhs' {
quietly replace `m' = `m' + `var'*`at'[1,`i'] `if'
local `++i'
quietly replace `m' = `m' + `at'[1,`i'] `if'     // constant
quietly replace `varlist' = `depvar' - `m' `if'

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index