Thank you very much! I will give a look to the varsimul function!!

On 14/06/2013 8:40 PM, "Allin Cottrell" <cottrell@wfu.edu> wrote:
On Fri, 14 Jun 2013, Gabriela Nodari wrote:

> 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) [...]

Check out the varsimul() function. Here's a simple example of
use:

<hansl>
open data9-7
var 4 PRIME UNEMP --silent
matrix A = $compan[1:2,]
# residuals + const
matrix U = $uhat .+ $coeff[1,]
# initial values
matrix y0 = {PRIME, UNEMP}[1:4,]
# simulate the VAR
matrix X = varsimul(A, U, y0)
# check that we got back the original data
# (to within machine precision)
eval X - {PRIME, UNEMP}
# now resample U
matrix Us = resample(U)
matrix Xs = varsimul(A, Us, y0)
# look at the simulated data
print Xs
</hansl>

Use "set seed" if you want to be able to replicate the
resampling. Put the last few lines in a loop for multiple
simulations.

Allin Cottrell


_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users