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)
nl problem with modified Richards equationDear Team, I'm trying to fit modified Richards equation to simulated cumulated volume (v_elong) data…
Create a variable that defines the value of the next rowHi, I am using long form data. I have a variable called ia_label that defines an area of interest a…
Merging two continuous variables in the same datasetHi, I have two variables: 1) age of initiating cigarette use with values from 10-23 and 2) age of i…
Example of multilevel logistic regression with only level-2 predictorsHi there, I am building a multilevel logistic regression model without level-1 predictors. This mea…
SEM with fixed effectsHello. This is my first time posting on this forum. I am trying to examine whether student partici…
Subscribe to:
Post Comments (Atom)
0 Response to simulation not working (running only once)
Post a Comment