Thanks a lot Allin.
After one full day of thinking I eventually reached the same
conclusion ;-)
I was indeed working on a code like yours but for the fact that, given
that I am actually doing the bootstrap on a panel, as proposed by:
Silvia Gonzalves (2009), "The moving blocks bootstrap for panel linear
regression models with individual fixed effects"
after having created the matrix from the dataset:
matrix X = { dataset }
I reshape the matrix to have all the cross-sectional observations for a
given period on the same row:
matrix XW = {}
c = cols(X)
loop for i = 1..n --quiet
XW = XW~X[$i*t-t+1:$i*t,1:c]
endloop
Bye
Giuseppe Vittucci
On Wed, 2011-02-02 at 21:39 -0500, Allin Cottrell wrote:
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
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users