On Tue, 1 Feb 2011, Giuseppe Vittucci wrote:
Is there a simple way to do block PAIRS bootstrap?
Create a matrix, X0, holding the data pairs, and an appropriately
sized matrix, X1, for the result.
matrix X0 = {your_list}
matrix X1 = zeros(T, cols(X0))
Create a random vector, R, to pick the starting indices of the
blocks to be selected (you can use the muniform() function,
suitably scaled).
Loop across the elements of R, picking the selected row-blocks
from X0 and inserting them progressively into X1.
row = 1
loop i=1..n
r = R[i]
matrix tmp = X0[r:r+b-1,]
X1[row:row+b-1,] = tmp
row += b
endloop
If you want the columns of X1 as series, then use "nulldata" with
a suitable number of observations plus the --preserve option, and
do
series y = X1[,1]
series x = X1[,2]
or similar. Use "setobs" if you want to impose a time series
interpretation on the resampled data.
Allin Cottrell