Dear gretl users,

I would like to obtain simulated data by bootstrapping the residuals of a VAR model. I have gave a look to the gretl guide, and I found something related to resampling and bootstrapping (section 7.4), actually,  I would like to adapt the following example - 7.1 in the guide - (with ols) to the VAR framework:

ols y 0 x
genr ui = $uhat
scalar ybar = mean(y)
scalar replics = 2000
scalar tcount = 0
series ysim = 0
loop replics
ysim = ybar + resample(ui)
ols ysim 0 x
scalar tsim = abs($ coeff (x) / $stderr(x))
tcount +=(tsim > 2.5)
endloop

I have started to write a code.. but my "first" problem is how to save the matrix of residuals and then generate the new dataset.  The next one I guess will be how to store 2000 Irfs!  But let's go step by step..

Would someone have any suggestion?

Thanks in advance. 
Gabriela