Hi Statalisters,
you could save my life!
I want to estimate a model of the form
y = exp(x1+x2+constant) * error.
with GMM. The error has mean 1.
I set up moment conditions of the type (E is the expectation operator)
E[error|x1,x2] = 1 => E y exp(-x1-x2-constant) - 1 = 0, etc.
When I estimate this, I get the error: missing values encountered in analytic gradient r(416);
To illustrate my problem, here is an example of what happens.
When my y is actually generated by my model, the estimation goes through (Example 1).
When my y is just some unrelated random variable, I get the error above (Example 2).
I would have expected that GMM would just give me insignificant parameter estimates instead of this error.
Even more surprising to me, Example 2 does go through when I multiply y with 100 before estimating.
So, why would GMM fail because the dependent variable is close to 0?
Why would GMM fail because the model is bad?
Why do I get missing values in the analytic gradient, even though there are no missing values?
Thanks a lot for any help!
Simon
*****************************Example 1 - works
clear
set seed 1
set obs 1000
gen x1 = runiform()
gen x2 = runiform()
gen error = runiform() * 2
***
gen y = exp(x1+x2+1) * error
***
gmm(y* exp(-{x: x1 x2 _cons}) - 1), ///
conv_maxiter(100) instruments(x1 x2) deriv(/x = -y*exp(-{x:}))
***********************Example 2 - does not
clear
set obs 1000
gen x1 = runiform()
gen x2 = runiform()
gen error = runiform() * 2
***Only these 3 lines are different!
gen y = runiform()
egen Ty = sum(y)
replace y = y/Ty
***
gmm(y* exp(-{x: x1 x2 _cons}) - 1), ///
conv_maxiter(100) instruments(x1 x2) deriv(/x = -y*exp(-{x:}))
************************
you could save my life!
I want to estimate a model of the form
y = exp(x1+x2+constant) * error.
with GMM. The error has mean 1.
I set up moment conditions of the type (E is the expectation operator)
E[error|x1,x2] = 1 => E y exp(-x1-x2-constant) - 1 = 0, etc.
When I estimate this, I get the error: missing values encountered in analytic gradient r(416);
To illustrate my problem, here is an example of what happens.
When my y is actually generated by my model, the estimation goes through (Example 1).
When my y is just some unrelated random variable, I get the error above (Example 2).
I would have expected that GMM would just give me insignificant parameter estimates instead of this error.
Even more surprising to me, Example 2 does go through when I multiply y with 100 before estimating.
So, why would GMM fail because the dependent variable is close to 0?
Why would GMM fail because the model is bad?
Why do I get missing values in the analytic gradient, even though there are no missing values?
Thanks a lot for any help!
Simon
*****************************Example 1 - works
clear
set seed 1
set obs 1000
gen x1 = runiform()
gen x2 = runiform()
gen error = runiform() * 2
***
gen y = exp(x1+x2+1) * error
***
gmm(y* exp(-{x: x1 x2 _cons}) - 1), ///
conv_maxiter(100) instruments(x1 x2) deriv(/x = -y*exp(-{x:}))
***********************Example 2 - does not
clear
set obs 1000
gen x1 = runiform()
gen x2 = runiform()
gen error = runiform() * 2
***Only these 3 lines are different!
gen y = runiform()
egen Ty = sum(y)
replace y = y/Ty
***
gmm(y* exp(-{x: x1 x2 _cons}) - 1), ///
conv_maxiter(100) instruments(x1 x2) deriv(/x = -y*exp(-{x:}))
************************
Comment