We are using GMM in Stata to estimate parameters of a nonlinear asset pricing model, with 5 moment conditions of the form E(u*Z)=0, where the 5 instruments Z are in the set {1 (constant), P, Q, R, S}, and the 3 parameters are in the set {rho, sigma1, sigma2}.

After some trial and error, in which we have sometimes got estimates, sometimes struggled to achieve convergence, and have so far played with other decisions -- starting values, winit, wmat, vce options, tolerance -- we now want to consider using the exact analytical derivatives in place of the numerical derivatives that GMM in Stata uses. We have computed these 15 (=5-x-3) elements of the Jacobian of the 5 moment conditions with respect to the 3 parameters in a separate symbolic algebra package (MAXIMA) and we have those expressions in Fortran form, with Fortran continuation lines, (close to Stata form with subsequent addition of curly brackets for parameters; e.g.

J(1,1) = (Q*{rho}*{sigma2})/sqrt(1-{rho}**2)-P*
1 {sigma1}



QUESTION: What is the correct syntax in Stata/GMM for entering these exact analytical derivatives?

We have seen STATA-GMM documentation in https://www.stata.com/manuals13/rgmm.pdf (in particular, pp.3 ["Derivatives"], and pp.24-25 ["Specifying Derivatives," Examples 7 and 8]. None of those references exactly matches our problem.

Before worrying about analytical derivatives, we specified our GMM problem in Stata in the compact form, as (for example)

. gmm (Eq1:P - (1 + {rho}*{sigma1})*Q - ({sigma2})*(sqrt(1-{rho}^2))*R) if sample_to_use == 3, instruments(P
> Q R S) wmatrix(cluster cnum) winitial(WW_INV) vce(cluster cnum) technique(bfgs)

The examples in the Stata documentation above, pp.3 and pp.24-25, suggest -- when there is a single equation and instrument -- that we just use:

derivative(/rho = <exact analytical derivative of the one equation w.r.t. rho>)

where one RHS would be, using the above,

(Q*{rho}*{sigma2})/sqrt(1-{rho}**2)-P*{sigma1}

When we have really 5 moment conditions, though we have stated it compactly above, it is not clear what we need to do. There must be some way out. Any guidance or an example would be greatly appreciated. Please help. Thank you.