Hello,

I am running a 'gmm' estimation and need to specify constraints on the coefficients. Because of these constraints, I run into numerical errors (non-PSD hessian) and I need to hand-specify the derivatives. Is there a way to specify second-order derivatives in 'gmm'?

Below is an example: I first run the code with the command 'gmm' alone, then specify first order derivatives, but I don't know how to specify second order derivatives...

Best,
Maxime

Code:
bcuse fertil2

bcuse fertil2

global x1 "educ age agesq electric tv spirit protest catholic _cons"
global z "frsthalf age agesq electric tv spirit protest catholic"

* (a) GMM​​
gmm (children*exp(-{xb: $x1})-1),instruments($z)

* (b) Specifying derivatives
gmm (children*exp(-{xb: $x1})-1),instruments($z) ///
    deriv(/xb=- children*exp(-{xb:}))