Bootstrapping with restricted range

Econometrics questions and discussions
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Bootstrapping with restricted range

Unread post by TomDoan »

This shows how to modify BOOT to produce a choice within a subset of entries. As written, BOOT only allows you to select within a range of consecutive entries. This allows a more general selection. It uses ORDER with the INDEX option to get a re-mapping index into the desired subset of entries. You just have to draw over the reduced range and use the index produced to alter the original entry draws produced by BOOT.

Code: Select all

all 200
*
* Source range
*
compute gstart=1,gend=100
set test gstart gend = %ran(1.0)
*
* Create indexing function into the source range, only for observations
* which are negative. (Any SMPL criterion can be used instead).
*
order(smpl=test<0,index=myindex) constant gstart gend
*
* Determine the end of the (indexed) range which meets the criterion.
* The entries map to gstart->gstart+%nobs-1, since %nobs will be the
* number of data points which met the SMPL.
*
compute bstart=gstart,bend=bstart+%nobs-1
*
* Target range
*
compute tstart=101,tend=200
*
* Draw boot entries, then remap them to the entries in the original series
*
boot entries tstart tend bstart bend
gset entries tstart tend = myindex(entries(t))
*
* Use the remapped entries as needed
*
set allnegative tstart tend = test(entries(t))
stats(fractiles) allnegative
Post Reply