As a novice in Stata programming I wrote a short bootstrap program as an
exercise from Cristian's question. I guess my code does the same thing as
the bootstrap prefix (that was my intention by the way)? Does anyone have
any corrections or comments?
-----
* Creating the dataset
clear
set obs 50
gen byte group=mod(_n,10)
sort group
gen byte country=0
replace country=1 in 26/50
gen y=uniform()
* Bootstrap program
quietly xi, noomit: reg y i.country, noconstant cluster(group)
matrix beta = e(b)
capture program drop boot_noc
program define boot_noc, rclass
preserve
bsample
xi, noomit: reg y i.country, noconstant cluster(group)
return list
restore
end
simulate, reps(100) seed(12345): boot_noc
bstat, stat(beta) n(50)
estat bootstrap, all
-----
Best,
Johan Hellstrom
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/