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

# Re: st: Bootstrap strata

 From Steve Samuels <[email protected]> To [email protected] Subject Re: st: Bootstrap strata Date Tue, 4 Jun 2013 19:28:21 -0400

```Laura:

The coefficients reported after -bootstrap- will be the coefficients for
from -regress- on the full sample. You want the mean  of the coefficients
from the -bootstrap- samples. You can get these with:

. estat bootstrap, all
. matrix list e(b_bs)

Throwing out data can be inefficient. As you have nested observations,
you might try -xtmixed- with robust standard errors and compare the
results.

Steve

On Jun 4, 2013, at 12:53 PM, Laura Gibbons wrote:

> In case someone else has this problem in the future, here is what I found out:
>
> By default, the -strata- option for -bootstrap- would perform
> sampling with replacement within each strata; but the default number
> of observations is the number of observations present in the dataset.
>
> If a person has 7 observations, the sample will consist of
> 7 observations for that person; the difference with the original
> dataset is that it will be a sample with replacement, i.e., repeated
> observations might be present.
>
> For my purposes, since I want my samples per individual have size 1, I need to specify that as follows:
>
>  bootstrap, strata(id) size(1): regress...
>

On Fri, 31 May 2013, Laura Gibbons wrote:

>
> I have data with 1 to 7 observations/person.  I want to randomly sample one observation/person in some sort of a bootstrapping process to get an appropriate error term for, say, x.
>
> I can set this up myself using a loop around the -bsample- command [bsample 1, strata(id)], posting the estimated coefficient for x each sample and taking the std dev of the mean of x for my 1000 times through the loop.
>
> Is there a way to do this directly in -bootstrap-?  Here is what the manual says about the strata option there:
>
>   strata(varlist) specifies the variables that identify strata.  If this
>       option is specified, bootstrap samples are taken independently within
>       each stratum.
>
> It is not clear to me what that means.  Does it mean it will sample once from each stratum?  I think not, based on my results, but I honestly can't tell.
>
> Many thanks,
>
> Laura
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Laura E. Gibbons, PhD
> General Internal Medicine, University of Washington
> Box 359780, Harborview Medical Center, 325 Ninth Ave, Seattle, WA 98104
> phone: 206-744-1842, fax: 206-744-9917,
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Laura E. Gibbons, PhD
General Internal Medicine, University of Washington
Box 359780, Harborview Medical Center, 325 Ninth Ave, Seattle, WA 98104
phone: 206-744-1842, fax: 206-744-9917,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

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