Good evening to everyone,
I would like to run a loop where a parameter that takes an initial value I decided is then updated at the end of the loop to take another value I estimated, and then the loop restarts until the difference between the initial condition and the estimated parameter is negligible. This is what I've tried:
I get the error:
After the GMM is run... I don't understand where should I put the bracket... Could someone help me?
Thanks in advance for the help!
I would like to run a loop where a parameter that takes an initial value I decided is then updated at the end of the loop to take another value I estimated, and then the loop restarts until the difference between the initial condition and the estimated parameter is negligible. This is what I've tried:
Code:
reg y l k i.sector_id i.t
scalar b_0_star_LP = _b[k] /* This guy is the starting value */
forvalues i = 0/100{
gen omega_LP_`i' = phi_LP - b_`i'_star_LP*k
gen omega_h_LP_`i' = phi_h_LP - b_`i'_star_LP*k
gen lead_omega_LP_`i' = F.omega_LP_`i'
npregress kernel lead_omega_LP_`i' omega_h_LP_`i'
predict E_omega_LP_`i'
ivregress gmm lead_phi_LP lead_k (E_omega_LP_`i' = k i)
scalar b_`i+1'_star_LP = _b[lead_k]
if b_`i+1'_star_LP - b_`i'_star_LP < 0.00000001
break
}
Code:
{ required
Thanks in advance for the help!

Comment