Hi,
 
I am having some problems with GMM. I try to run the following script:
# initializations go here
series e1 = 0
series e2 = 0
set bfgs_toler 1e-7
set lbfgs 1
matrix W = I(10)
scalar beta = 0.95
scalar lambda = 0.05
scalar sigma = 1.05
scalar gamma = 0.1
scalar phi = 0.3
scalar theta = 1
list IVs = const R_DETREND(-1) CONSUMPTION_GRO(-1) GDP_GROWTH(-1) LN_RATIO_DETREN(-1)
# list IVs = const R_DETREND(-1) R_DETREND(-2) R_DETREND(-3) CONSUMPTION_GRO(-1) CONSUMPTION_GRO(-2) CONSUMPTION_GRO(-3) GDP_GROWTH(-1) GDP_GROWTH(-2) GDP_GROWTH(-3) LN_RATIO_DETREN(-1) LN_RATIO_DETREN(-2) LN_RATIO_DETREN(-3)
gmm
 e1 = (R_DETREND * beta * (((CONS_DETREND(+1) - lambda * GDP_DETREND(+1)) ^ ((-1) * (sigma))) * ((CONS_DETREND - lambda * GDP_DETREND) ^ (gamma)) * (LABOR_DETREND(+1) ^ phi) + (gamma * beta * ((CONS_DETREND(+2) - lambda * GDP_DETREND(+2)) ^ (1 - sigma)) * ((CONS_DETREND(+1) - lambda * GDP_DETREND(+1)) ^ (gamma - 1)) * (LABOR_DETREND(+2) ^ phi)) / (1-sigma)) - (((CONS_DETREND - lambda * GDP_DETREND) ^ ((-1) * (sigma))) * ((CONS_DETREND(-1) - lambda * GDP_DETREND(-1)) ^ (gamma)) * (LABOR_DETREND ^ phi) + (gamma * beta * ((CONS_DETREND(+1) - lambda * GDP_DETREND(+1)) ^ (1 - sigma)) * ((CONS_DETREND - lambda * GDP_DETREND) ^ (gamma - 1)) * (LABOR_DETREND(+1) ^ phi)) / (1-sigma)))
 e2 = (phi * ((CONS_DETREND - lambda * GDP_DETREND) ^ (1 - sigma)) * ((CONS_DETREND(-1) - lambda * GDP_DETREND(-1)) ^ gamma) * (LABOR_DETREND ^ (phi-1))) / (1-sigma) + (((CONS_DETREND - lambda * GDP_DETREND) ^ ((-1) * sigma)) * ((CONS_DETREND(-1) - lambda * GDP_DETREND(-1)) ^ gamma) * (LABOR_DETREND ^ phi) + (beta * gamma * beta * ((CONS_DETREND(+1) - lambda * GDP_DETREND(+1)) ^ (1-sigma)) * ((CONS_DETREND - lambda * GDP_DETREND) ^ (gamma - 1)) * (LABOR_DETREND(+1) ^ phi)) / (1 - sigma)) * (-theta) * ((1 - LABOR_DETREND) ^ (theta - 1)))
 
 
  orthog e1 ; IVs
  orthog e2 ; IVs
  weights W
  params beta lambda sigma gamma phi
end gmm --iterate
And get all kinds of error messages. I have tried running this with various different starting values of the parameters and I get a different error message each time. So far I have seen: "convergence criterion was not met", "missing values encountered", "insufficient degrees of freedom" and "matrix not positive definite". Other times it gives me results but they are identical to the starting values and the std. errors are all 0. All this just by changing the starting values. Does anyone have an explanation for this? And how to solve it?