Bookmark and Share

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

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

Re: st: Saving bootstrap samples

From   Margaret MacDougall <>
Subject   Re: st: Saving bootstrap samples
Date   Sat, 15 Jun 2013 08:39:38 +0100

Dear Maarten

Thanks for your reply. It is the saving of the bootstrap samples I was specifically asking about, but I would wish to save them in addition to the output generated for particular parameters. Is it possible to combine these two tasks?

Best wishes


Dr Margaret MacDougall
Medical Statistician and Researcher in Education
Centre for Population Health Sciences
University of Edinburgh Medical School
Teviot Place
Edinburgh EH8 9AG

Tel:  +44 (0)131 650 3211
Fax:  +44 (0)131 650 6909

On 14/06/2013 14:40, Maarten Buis wrote:
On Fri, Jun 14, 2013 at 3:31 PM, Margaret MacDougall wrote:
I would value some tips on how best to go about saving bootstrap samples
generated by means of the bootstrap command in Stata.
Do you want to save the samples or the statistics computed in each
sample? The latter can easily be achieved using the -saving()- option.
The former is harder. You'll probably have to abandon -bootstrap- and
code the loop yourself and draw random observation in each iteration
using -bsample-. It is probably most convient to store those samples
as fweights, like so:

forvalues i = 1/10 {
     qui gen w`i' = .
     bsample , weight(w`i')

Hope this helps,

Maarten L. Buis
Reichpietschufer 50
10785 Berlin
*   For searches and help try:

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

*   For searches and help try:

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