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

# st: RE: Nonlinear GMM estimation

 From "Jay Tuthill" To Subject st: RE: Nonlinear GMM estimation Date Thu, 11 Nov 2010 14:46:27 -0500

```Cannot say I am anything close to an expert in nonlinear GMM, but for a
general engineering approach, am curious if you have tried plotting your
first y against x1 term and fitting strictly this equation followed by
plotting y against x1 and l1_x1 (assuming lag 1) and looking at your
response surface to see if it shows unstable regions and again, fitting
this 2 term equation and seeing how you make out. Of course, you have to
guess at the parameters when you are beginning. In other words, work up
to your full equations using reduced models. Even though the simpler
models may have no meaning, solving them may give you clues to solving
the full equation.

Regards...Jay Tuthill

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of McLaughlin,
David
Sent: Wednesday, November 10, 2010 9:30 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: Nonlinear GMM estimation

Hi Everyone,

Background
I have been trying to Stata 11.1 to instrument for x1 in the following
nonlinear equation using the gmm moment evaluator program:

y={b0}*(1-exp({gamma0}*x1)+{b1}*(1-exp({gamma0}*l1_x1)+{b2}*(1-exp({gamm
a0}*l2_x1)+{b3}*///
(1-exp({gamma0}*l3_x1)+{alpha}*x2

I created a moment evaluator program and called it with gmm (below):

program gmm_dsm
version 11
syntax varlist if, at(name)
quietly {
tempvar mu nu
gen double `mu' =0
replace `mu' = `at'[1,1]*(1-exp(`at'[1,5]*x1))+
`at'[1,2]*(1-exp(`at'[1,5]*l1_x1))
+ `at'[1,3]*(1-exp(`at'[1,5]*l2_x1))+
`at'[1,4]*(1-exp(`at'[1,5]*l3_x1))+ *`at'[1,6]*x2
replace `varlist' = y - `mu'
}
end

gmm gmm_dsm if, nequations(1) parameters(b0 b1 b2 b3 gamma0 alpha)
instruments(x1 l1_x1 l2_x1 l3_x1  _instrument  x2, noconstant)
vce(cluster id) onestep from(b0 -.00056 b1 -.0028 b2 -.00087 b3 -.004
gamma -83 alpha .05)

Issue

When I run call the program, it begins to run and then I receive the
following error:

"could not calculate numerical derivatives -- flat or discontinuous
region encountered
could not calculate numerical derivatives -- flat or discontinuous
region encountered
r(430);"

Questions

1.) Can you use the moment evaluator function of gmm in Stata 11 to
estimate an equation that is nonlinear in the parameters?
2.) Is there a way to replicate the nonlinear results produced by nl()
using gm() for this equation considering I have more parameters than
"instruments" (covariates)?

Dave

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

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