I made all the code for the bootstrap and used the command "nulldata
#obs --preserve" to clear the dataset and create new series from the
matrices.
But unfortunately when the nulldata command is used in a loop the
program returns the following error:
"Sorry, this command is not available in loop mode"...
What command can I use which does not create problems in loops?
Bye
Giuseppe
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