Dear Friends,
I am trying to use GMM to estimate a model that is nonlinear in its parameters.
The model has 3 parameters: rho, sigma1, and sigma2.
I would like to obtain model coefficients, standard errors, and the value of the objective function for different combinations of starting values.
To accomplish this, I set up three do loops, one within the other, and let rho vary according the counter "j", sigma1 vary according to the counter, "k", and sigma2 vary according to the counter "l."
The code is below. The code works. However, I have two questions:
a. How can I get the values of j,k, and l to be displayed after each step in the loop
For example, when I include display j, in the code below, I get "j not found" and the program exits.
b. Sometimes, GMM does not converge and I get the following message, "flat or discontinuous region encountered" and the program exits the do loop. Is there some way I can include
a line which causes the program to go to the next loop increment, rather than exiting the program? In fortran, I could do this with an error handling condition.
Thanks so much!
Srinivasan Rangan
Code:
foreach j in 0.1 0.2 0.3 0.4 0.5 {
foreach k in 5 10 {
foreach l in 5 10 {
gmm (Eq1:abn_ret2_unwinsored_stage1_w - (1 + {rho}*{sigma1})*ue_p_scaled_centered_w - ({sigma2})*(sqrt(1-{rho}^2))*tq2_w_centered) if sample_to_use == 3, instruments(ue_p_scaled_centered_w tq2_centered_w lag2mret_w lag2chusd_w) winitial(identity) vce(cluster cnum) from(rho `j' sigma1 `k' sigma2 `l') technique(bfgs) wmatrix(unadjusted)
mat list e(b)
mat list e(V)
display e(Q)
}
}
}
Related Posts with GMM estimation inside a do loop with foreach
Insufficient observations in GLLAMMDear statalists, Sorry to disturb you again!I face some difficulties when I use gllamm command to do…
Panel-Data Logistic regression Probability of LR Test is 1Dear Statalist, I have a question concerning the a logistic regression with panel data. I have a pa…
Epimodels package for Stata has been updated at SSCThanks to Kit Baum the epimodels package for Stata has been updated at SSC. Epimodels (written by S…
Panel-Data Problems with the xtlogit commandDear Statalist, I have a question concerning the a logistic regression with panel data. I have a pa…
Problem with Panel ARDL MG PMGi am working on oil price shocks where i have divided price shocks into positive and negative shocks…
Subscribe to:
Post Comments (Atom)
0 Response to GMM estimation inside a do loop with foreach
Post a Comment