Hi, Stata people. I am really sorry to post this again. I am assigning random treatment and then want to run the regression 1000 times. However, now my regression is only running for once..
Please, Please help
set more off
set matsize 800
cap program drop model
set seed 6000
set obs1280
program model, rclass
generate random=uniform()
sort year random
generate post=0
replace post=1 in 1 in 1/29 // for year 2010
replace post=1 in 296/337 // for year 2011
replace post=1 in 578/619 // for year 2012
reg wheat post i.country_id i.year i.country#c.line_time_trend [aw=ypop], cluster( country_id )
return scalar tau_coeff = _b[post]
return scalar tau_se = _se[post]
return scalar r2 = e(r2)
exit
end
simulate coeff=r(coeff) se=r(se) r2=r(r2), reps(1000): model
sum
Related Posts with simulation not working (running only once)
Creating partial mapsI have a dataset which defines the boundaries and geographic regions of the world's countries, as sh…
instrument variable when using bins of endogenous independent variable as independent variablesDear All, In my research, for example, trunk is the endogenous independent variable of interest and…
Problems with collapse commandHello everyone, I have a dataset with Italian data on electoral outcomes. My dataset contains inform…
Multiple omitted categories when interacting?Possibly a rudimentary question, but I am unsure how my interaction is behaving this way. When I use…
Trying to delete date duplicates for each panelID Hello everyone, I have a panel dataset with vehicle-id and refueling dates. Now I am cleaning this …
Subscribe to:
Post Comments (Atom)
0 Response to simulation not working (running only once)
Post a Comment