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)
ageHello I have a research question involving annual savings by individuals and that I have a panel dat…
How to perform unit root tests for highly unbalanced panel with many time gaps?Dear all, My panel is highly unbalanced, with total observations of 350 and lots of time gaps. Thes…
Visualizing cross-level interaction in a mixed modelDear All, Apologies in advance if I am not including all necessary information, this is my first ti…
Issue replicating stcox results with clogit using discrete time dataDear Stata Folk Here is some background on what I am doing. I'm conducting an event history analysi…
BLP CrossectionalI am working on a project where I observe brands over years. I seek to use BLP for demand estimation…
Subscribe to:
Post Comments (Atom)
0 Response to simulation not working (running only once)
Post a Comment