Dear all,
I would like to visualize the standard errors associated with a
bootstrapped regression as the number of replications is increased. The
purpose of this is to assess how many replications to perform. I wrote the
following code designed for qreg regressions. I named it grbs for "graph
bootstrap".
-----------------------------
capture program drop grbs
program define grbs
version 9
postfile results n sa using data, replace
forvalues n=2(5)10{
noisily display "`n'" "`sa'"
set seed 123456789
quietly bootstrap "qreg $y $x" _b, reps(`n')
local n=e(N_reps)
local sa=e(sum_adev)
post results (`n') (`sa')
}
postclose results
end
use data, clear
graph twoway scatter sa n, xtitle("replications") ytitle("bootstrap
standard error")
-----------------------------
I am no programmer -- the code was put together by using related bits of
codes found here and there. There is clearly an error somewhere (or
several) as the saved dataset "data.dta" appears with missing values.
Any hints would be greatly appreciated.
Patrick.
[email protected]
*
* 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/