Hello forum members,
I am estimating the following model:
where y(it) is an over-dispersed non-negative count, x1-x4(it) are exogenous, x5(it) is an endogenous binary predictor, and z1-z3(it) are instruments.
Alternatively, to account for fixed effects in a panel model, I first use the code as suggested in Trivedi (2010) slide 54 (http://www.stata.com/meeting/mexico1...ug_trivedi.pdf):
And second, run the following as suggested in the example by Trivedi (2010) slide 55:
But obviously this is not the model that I intend to run (as specified above). When I try something like below, I get an error.
Please advise on how I should run -gmm- for the kind of model as specified in -ivpoisson- above.
I am estimating the following model:
Code:
ivpoisson gmm y x1 x2 x3 x4 (x5 = z1 z2 z3), additive
Alternatively, to account for fixed effects in a panel model, I first use the code as suggested in Trivedi (2010) slide 54 (http://www.stata.com/meeting/mexico1...ug_trivedi.pdf):
Code:
program gmm_poi9 version 13 syntax varlist if, at(name) myrhs(varlist) mylhs(varlist) myidvar(varlist) quietly { tempvar mu mubar ybar gen double `mu' = 0 `if' local j=1 foreach var of varlist `myrhs' { replace `mu' = `mu' + `var'*`at'[1,`j'] `if' local j = `j' + 1 } replace `mu' = exp(`mu') egen double `mubar' = mean(`mu') `if', by(`myidvar') egen double `ybar' = mean(`mylhs') `if', by(`myidvar') replace `varlist' = `mylhs' - `mu'*`ybar'/`mubar' `if' } end
Code:
gmm gmm_poi9, mylhs(y) myrhs(x1 x2 x3 x4) myidvar(id) nequations(1) parameters(x1 x2 x3 x4) instruments (x1 x2 x3 x4), noconstant) onestep Step 1 Iteration 0: GMM criterion Q(b) = 3.011e+09 Iteration 1: GMM criterion Q(b) = 77983166 Iteration 2: GMM criterion Q(b) = 531272.52 Iteration 3: GMM criterion Q(b) = 124.19557 Iteration 4: GMM criterion Q(b) = .0000135 Iteration 5: GMM criterion Q(b) = 6.730e-18 GMM estimation Number of parameters = 4 Number of moments = 4 Initial weight matrix: Unadjusted Number of obs = 8553 ------------------------------------------------------------------------------ | Robust | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- x1| .008391 .0005281 15.89 0.000 .007356 .0094261 x2| .0047405 .0016874 2.81 0.005 .0014333 .0080477 x3| -.0003832 .0002428 -1.58 0.115 -.0008591 .0000927 x4 | .4729073 .0646742 7.31 0.000 .3461482 .5996665 ------------------------------------------------------------------------------ Instruments for equation 1: x1 x2 x3 x4
Code:
gmm gmm_poi9, mylhs(y) myrhs(x1 x2 x3 x4) myidvar(id) nequations(1) parameters(x5) instruments(z1 z2 z3, noconstant) onestep no non-missing values returned for equation 1 at initial values r(498);
Comment