*
* @BlockBoot( options ) boot start end
*
* BlockBoot is an alternative to the BOOT instruction which does
* block draws. You use the output "boot" SERIES[INTEGERS] to do
* the resampling that you require.
*
* Parameters:
*
* boot = (output) SERIES[INTEGER] of draws for the entry numbers
* start end = range of entries
*
* Options:
* BLOCK=block size [5]
* [OVERLAP]/NOOVERLAP If OVERLAP, choose overlapping blocks;
* if NOOVERLAP, they are non-overlapping
*
* Revision Schedule:
* 08/05 Written by Tom Doan, Estima
*
procedure BlockBoot boot start end
type series[int] *boot
type integer start end
*
option integer block 5
option switch overlap 1
*
local integer nblocks ndraw range i
local vect[int] draws
*
if .not.%defined(start).or..not.%defined(end) {
disp '## Syntax: @BlockBoot boot start end'
return
}
*
compute range=end-start+1
*
* Number of available blocks
*
if overlap
compute nblocks=(range-block+1)
else
compute nblocks=range/block
*
* Number of blocks that need to be drawn
*
compute ndraw=range/block+1
*
dim draws(ndraw)
*
* Draw the starting points for the blocks
*
if overlap
ewise draws(i)=%raninteger(start,start+nblocks-1)
else
ewise draws(i)=start+block*(%raninteger(0,nblocks-1))
*
* Fill in the boot array by adding the starting point for a block
* to the sequence within it.
*
gset boot start end = draws((t-start)/block+1)+%mod(t-start,block)
end