Matrix assigments problems
Posted: Sat Jul 21, 2012 8:37 am
Greetings everyone!
I have a small problem I could use some help with.
I am trying to compute a rolling VAR and rearrange the output coefficients in a row of a new matrix (A), so I could plot their evolution over time.
The only problem is that during the assignment process, the new matrix (A) does not contain the coefficients as they appear in the var output.
I've stuck for 3days now. This is the code as I wrote it:
--------------------------
Can anyone give me fresh insight please!!!!
Thank you in advance!
DIALLO85
I have a small problem I could use some help with.
I am trying to compute a rolling VAR and rearrange the output coefficients in a row of a new matrix (A), so I could plot their evolution over time.
The only problem is that during the assignment process, the new matrix (A) does not contain the coefficients as they appear in the var output.
I've stuck for 3days now. This is the code as I wrote it:
Code: Select all
' set sample
smpl @all
' find size of workfile
series _temp = 1
!length = @obs(_temp)
delete _temp
' set fixed sample size
!ssize = 1002
!lag=1
'Create Group containing all variables to include in var
group G CAC DJ EON EXCH IMS INT5 NSDQ OIL
'Number of columns in VAR output
!K = G.@count
for !t = 1 to !length-!ssize+1
' set rolling subsample
smpl @first+!t-1 @first+!t+!ssize-2
'Create VAR system
var var.LS 1 !lag CAC DJ EON EXCH IMS INT5 NSDQ OIL
matrix((!K*!lag)+1,!K) temp = var.@coefmat
for !c = 1 to (!K*(!K*!lag)+1)
for !j = 1 to !K
for !i = 1 to ((!k*!lag)+1)
'save coefficients
var_coefs(!t,!c) = temp(!i,1)
next
next
next
next
show var_coefs--------------------------
Can anyone give me fresh insight please!!!!
Thank you in advance!
DIALLO85