Matrix Fill from VAR Coefficients (Quick Question)
Posted: Sat Apr 02, 2011 1:47 pm
by alex_hk90
I'm trying to transfer the coefficients from a reduced form VAR to coefficient matrices, but the way I've tried seems to require going via a scalar variable.
In the simplest case, the following works:
scalar C1_11 = var01.c(1,1)
var01_C1.fill(b=r) C1_11, 0, 0, 0, 0, 0, 0, 0, 0
But the following doesn't (it returns 'Syntax error'):
var01_C1.fill(b=r) var01.c(1,1), 0, 0, 0, 0, 0, 0, 0, 0
Is there any way of doing it that doesn't require temporary scalar variables?
Thanks in advance. :)
Re: Matrix Fill from VAR Coefficients (Quick Question)
Posted: Sat Apr 02, 2011 1:52 pm
by EViews Gareth
Code: Select all
var01_c1 = 0
var01_c1(1,1) = var01.c(1,1)
Re: Matrix Fill from VAR Coefficients (Quick Question)
Posted: Sat Apr 02, 2011 2:15 pm
by alex_hk90
Code: Select all
var01_c1 = 0
var01_c1(1,1) = var01.c(1,1)
Thanks for the very quick reply. :) That method would still require one line per element, but it looks like it can easily be put in a loop so that's fine. :)
Re: Matrix Fill from VAR Coefficients (Quick Question)
Posted: Sat Apr 02, 2011 2:38 pm
by EViews Gareth
It isn't particularly clear what you're trying to do. Why not just do:
Re: Matrix Fill from VAR Coefficients (Quick Question)
Posted: Sat Apr 02, 2011 2:44 pm
by alex_hk90
It isn't particularly clear what you're trying to do. Why not just do:
I want it in the standard format (where C1 is the matrix of all lag 1 coefficients, C2 for lag 2, etc.), where:
x_t = C1*x_t-1 + C2*x_t-2 + ...
is the reduced form VAR.
So with your first reply I can now just do:
Code: Select all
matrix(3,3) {%0}
for !i = 1 to 3
for !j = 1 to 3
{%0}(!i,!j) = var01.c(!i,({%1}+(!j-1)*4))
next
next
(where var01 is the reduced form VAR(4) [hence the hard-coded 4]; %0 is the resulting matrix [C#]; %1 is the lag [#])
Thanks again. :)