Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: NonLinear GMM using moment evaluator program


From   Atul Nepal <nepal2@illinois.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: NonLinear GMM using moment evaluator program
Date   Thu, 30 May 2013 23:16:18 -0500

Dear Stata Users,

I am having trouble with the GMM moment evaluator program. I am using
Stata 12 on Windows. This is my first attempt to use the moment
evaluator program for non-linear GMM.
I am new to statalist. My moment evaluator program is as follows:


___________________________________________
program mygmmprog

syntax varlist if, at(name)
quietly{
tempvar wmstar wfstar ystar lhm lhf

tempname am1 am2 am3 am41 af1 af2 af3 af41 lm lf l1

scalar am1 = `at'[1,1]
scalar am2 = `at'[1,2]
scalar am3 = `at'[1,3]
scalar am41 = `at'[1,4]


scalar l1 = `at'[1,5]
scalar lm = `at'[1,6]
scalar lf =  `at'[1,7]


gen double `wmstar' = 0
gen double `wfstar' = 0
gen double `ystar' = 0


replace `wmstar' = (lm * Pz1z1)/ (l1 *Lm)
replace `wfstar' = (lf * Pz1z1)/ (l1 *Lf)
replace `ystar' = (P1z1/l1) -PzZ+ wm*Mm +wf*Mf + Y + `wmstar'*(Nm-Hm)
+ `wfstar'*(Nf-Hf)

replace `varlist' =  lhm - am1 * `wmstar' - am2 * `wfstar'- am3 *
`ystar' - am41 * A1

}
end

____________________________________________
*call to the program
gmm mygmmprog, nequation(1) ///
parameters(am1 am2 am3 am41 l1 lm lf) instruments(Pz1z1 Hm Hf Lm Lf Mm
Mf Nm Nf wm wf Y PzZ P1z1 A1) winitial(identity) ///
variables(Pz1z1 Hm Hf Lm Lf Mm Mf Nm Nf wm wf Y PzZ P1z1 A1) from(l1
0.1 lm 0.1 lf 0.1)
_______________________________________________
The error message I am getting is "could not calculate numerical
derivatives -- flat or discontinuous region encountered
could not calculate numerical derivatives -- flat or discontinuous
region encountered
r(430);"

I am not sure what should I do. I checked the derivative w.r.t
parameters, they are the functions of data.  When I set l1 lm and lf
to a particular value and call the program in this way,

gmm mygmmprog, nequation(1) ///
parameters(am1 am2 am3 am41) instruments(Pz1z1 Hm Hf Lm Lf Mm Mf Nm Nf
wm wf Y PzZ P1z1 A1) wmatrix(unadjusted) winitial(identity) ///
variables(Pz1z1 Hm Hf Lm Lf Mm Mf Nm Nf wm wf Y PzZ P1z1 A1)

warning: 1106 missing values returned for equation 1 at initial values

Step 1
Iteration 0:   GMM criterion Q(b) =  2.800e+09
Iteration 1:   GMM criterion Q(b) =  1426.2411
Iteration 2:   GMM criterion Q(b) =  1426.2411

Step 2
Iteration 0:   GMM criterion Q(b) =  .95962597
Iteration 1:   GMM criterion Q(b) =  .55574687
Iteration 2:   GMM criterion Q(b) =  .55574687

GMM estimation

Number of parameters =   4
Number of moments    =  16
Initial weight matrix: Identity                       Number of obs  =    9884
GMM weight matrix:     Unadjusted

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        /am1 |   .0077822   .0002379    32.72   0.000      .007316    .0082484
        /am2 |  -.0032615   .0001179   -27.66   0.000    -.0034926   -.0030304
        /am3 |  -1.83e-06   2.93e-07    -6.24   0.000    -2.40e-06   -1.25e-06
       /am41 |   1.424702   .0091934   154.97   0.000     1.406683    1.442721
------------------------------------------------------------------------------
Instruments for equation 1: Pz1z1 Hm Hf Lm Lf Mm Mf Nm Nf wm wf Y PzZ
P1z1 A1 _cons


I am getting the parameter estimates for am1 am2 am3 and am4, but I am
interested in getting the values of l1 lm lf as well.

I would greatly appreciate for suggestions on this.

Sincerely,

Atul
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index