Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: loop for bootstrap ?


From   Maarten Buis <maartenlbuis@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: loop for bootstrap ?
Date   Wed, 2 May 2012 10:31:48 +0200

Oops, forgot the key part, that should have been:

*------------- begin example -------------
sysuse auto, clear
recode rep78 1/2=3
levelsof rep78
foreach lev in `r(levels)' {
   regress price mpg foreign if rep78 == `lev', vce(bootstrap)
}
*-------------- end example --------------

On Wed, May 2, 2012 at 10:27 AM, Maarten Buis <maartenlbuis@gmail.com> wrote:
> --- On Wed, May 2, 2012 at 10:04 AM, econqian222 wrote:
>>     I want to run a bootstrap by product(1,2,3,...) , the command is
>> written as:
>>     bysort product: bootstrap rmse=e(rmse), reps(100) seed(12345): regress
>> value quantity index
>>
>> If this bootstrapping method can't be combined with "bysort", then how to
>> write a loop for this bootstrap?
>
> *------------- begin example -------------
> sysuse auto, clear
> recode rep78 1/2=3
> levelsof rep78
> foreach lev in `r(levels)' {
>    regress price mpg foreign, vce(bootstrap)
> }
> *-------------- end example --------------
> (For more on examples I sent to the Statalist see:
> http://www.maartenbuis.nl/example_faq )
>
> -- Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
>
> http://www.maartenbuis.nl
> --------------------------



-- 
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany


http://www.maartenbuis.nl
--------------------------

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index