Restartable Bootstraps

Because bootstrap estimates can take so much computation, it is important that long bootstraps be restartable with minimal waste of computer and user time. Stata recognizes this and offers the -saving- option on the bootstrap command. In the reference manual this option is correctly rationalized with the following comment:

This option will allow recovery of partial results should some other software crash your computer. These partial results can be combined to reproduce exactly the results expected from an uninterrupted run.

I would suggest dividing the bootstrap into a number of pieces, and saving the coefficients from each replication in a separate file. For example this code obtains 500 replications in 10 blocks:

forvalues i=1/10 { set seed 123`i'456 quietly bootstrap, reps(50) saving(file`i'): reg y x } } If the job is interrupted at least some of the replications will have completed and need not be rerun. Setting the seed insures that each bootstrap is independent and reproducible. Once all the replications are completed it is possible to combine the replications and run the -bstat- command to obtain the bootstrap estimate. forvalues i=1/10 { append using file`i' } bstat in 1/L A do file that somewhat expands on this method also shows how to make the job restartable with no manual edit. It is also possible to use this method to divide a bootstrap across multiple computers, and thereby obtain results in less wall-clock time, if one has multiple computers, or does not have access to statamp.

The overhead of saving and appending is minimal.

It is likely the "saving" option is not more widely used because the -bstat- command is not mentioned in the -bootstrap- documentation, but -bstat- is fully documented and supported by Statacorp. The -in- qualifier of the -bstat- command is a bit surprising, but seems to be required or some replications will be omitted from the results.

Roodman's Boottest

David Powell reccomends -boottest.ado- for its speed, but it does have a memory leak. You should add -clear mata- after each invocation.
Last update 8 March 2017 by drf