Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: bootstrapped standard errors and noconstant


From   "Johan Hellstrom" <[email protected]>
To   <[email protected]>
Subject   Re: st: bootstrapped standard errors and noconstant
Date   Thu, 14 Jun 2007 18:19:59 +0200

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index