Dear all,
I have run the varsimul() function and it works well!
Now I am having some problems to estimate the var with simulated data..
The code I am running is the following:
scalar p = 6
list y = 8 13 12 1 2 3
var p y -- silent
matrix Ac = $compan[1:6,]
matrix U = $uhat.+$coeff[1,]
matrix y0 = {var1, var2, var3, var4, var5, var6}[1:6,]
list y1 = 8 13 12 1 2
list x = 3
var p y1; x
matrix Ac1 = $compan[1:5,]
matrix U1 = $uhat.+$coeff[1,]
matrix y01 = {var1, var2, var3, var4, var5}[1:6,]
loop (n. of replics)
matrix Usim = resample(U)
matrix Ysim = varsimul(Ac, Usim, y0)
matrix Usim1 = resample(U1)
matrix Ysim1 = vasimul(Ac1,Usim1,y01)
series frs = Ysim[,1]
series ips= Ysim[,2]
...
series baas=Ysim[,6]
var p frs ips ... baas
....
Here I get error: invalid option '--' var p frs...
I guess it is because I cannot enter these series in the var command..
Could someone help me? How can I estimate the var with the simulated data?
Thanks in advance..
Gabriela
2013/6/14 Gabriela Nodari <gabriela.nodari(a)gmail.com>
Thank you very much! I will give a look to the varsimul function!!
On 14/06/2013 8:40 PM, "Allin Cottrell" <cottrell(a)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(a)lists.wfu.edu
>
http://lists.wfu.edu/mailman/listinfo/gretl-users
>