Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Re: st: Bootstrapping standard errors of regression coefficients whilst applying bysort command |
Date | Sat, 28 Apr 2012 11:12:34 +0100 |
You have to bootstrap separate models separately. That means a loop in this case. Nick On Sat, Apr 28, 2012 at 5:17 AM, George Murray <george.murray16@gmail.com> wrote: > Dear Statalist, > > I have a dataset with variables V0 V1 V2 V3 V4, where I am regressing > V1 on V2, V3 and V4 for each value of V0 (so without bootstrapping, > the command would be –bysort V0: reg V1 V2 V3 V4- to estimate a > separate model for each value of V0), however I have not been able to > come up with a command to compute the bootstrapped standard errors of > the explanatory variables for each model. My first instinct was to run > –bootstrap, reps(100) seed(1): bys V0: reg V1 V2 V3 V4-, however > clearly this is not feasible (the error message is “bysort may not be > used in this context r(199)”), and am yet to find an alternative. I > also need to save (a) the bias-corrected standard errors of the > constants and (b) the residuals, of each model. Is there a code that > can produce these results in Stata? * * 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/