Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Bootstrap a vector in Mata


From   smerryman@kc.rr.com
To   statalist@hsphsun2.harvard.edu
Subject   st: Bootstrap a vector in Mata
Date   Thu, 13 Oct 2005 11:54:00 -0500

I would like to bootstrap a vector in Mata but I am not sure if I am 
doing it correctly.  My code is:

mata
mata clear
st_view(a=.,.,"x")
nr = rows(a)
for (i = 1; i <=1000; i++) {
 line5:   b = floor(uniform(nr,1)*nr + J(nr,1,1))
 line6:   boot=a[b]
          //other commands using boot
}
end

Are lines 5 and 6 sufficient to bootstrap vector "a"?

Thanks you,
Scott
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index