Dear all/Allin,

I am trying to follow Allin's suggestion while resampling data and estimating the var with lagged exogenous variables. However, I am getting an error  "ambiguos matrix index". 

I am not able to include the effect of the exogenous varibles.. the code I am running now is.

> D=max(abs(IP))
> tcount=0
> y = 8 13 12 1 2 3
> y1 = 8 13 12 1 2
> x = 21 22 23 24 25 26 #exogenous lagged variables
>
> #MODEL 1
> var 6 y --silent
> matrix Ac = $compan[1:6,]
> matrix U = $uhat. +$coeff[1,]
> #Initial values
> matrix y0 = {var1, var2, var3, var4, var5, var6}[1:6,]
>
> #MODEL 2
> var 6 y1; x --silent
> matrix Ac1 = $compan[1:5,]
> matrix U1 = $uhat.+coeff[1,] + $coeff[7,] .* {x}[7:] + $coeff[8,] .* {x}[8:] + $coeff[9,] .* {x}[9:] + $coeff[10,] .* {x}[10:] + $coeff11,] .* {x}[11:] + $coeff[12,] .* {x}[12:]
...

The error is appearing with respect to the last command above...

I would be very grateful for any suggestion!

Thanks in advance,
Gabriela







2013/6/18 Cottrell, Allin <cottrell@wfu.edu>
On Mon, Jun 17, 2013 at 7:30 AM, Gabriela Nodari
<gabriela.nodari@gmail.com> wrote:
> Yes, the code works! but I'm not sure the result is correct. [...]

> here is the complete code:
>
> D=max(abs(IP))
> tcount=0
> y = 8 13 12 1 2 3
> y1 = 8 13 12 1 2
> x = 3
>
> #MODEL 1
> var 6 y --silent
> matrix Ac = $compan[1:6,]
> matrix U = $uhat. +$coeff[1,]
> #Initial values
> matrix y0 = {var1, var2, var3, var4, var5, var6}[1:6,]
>
> #MODEL 2
> var 6 y1; x --silent
> matrix Ac1 = $compan[1:5,]
> matrix U1 = $uhat.+coeff[1,]

You need to include the effect of var6 in your MODEL 2 simulation.
After $coeff[1,] (the intercept) you should add

$coeff[7,] .* {x}[7:]

--
Allin Cottrell
Department of Economics
Wake Forest University
_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users