Assigning values and obtaining information from ARRAYS

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.
jjulioro
Posts: 8
Joined: Mon Sep 07, 2015 3:36 pm

Assigning values and obtaining information from ARRAYS

Unread post by jjulioro »

Dear all,

In my code I calculate at every time the realized volatility matrix of a set of financial prices which is output to a SYMMETRIC[REAL] object called VCVMAT.
I have also declared two different objects, a SYMMETRIC[SERIES] and a VECTOR[SYMMETRIC[REAL]] called MVOLATS and SIGMAS respectively

COMPUTE NVAR = 4
DECLARE SYMMETRIC[SERIES] MVOLATS(NVAR,NVAR)
DECLARE VECTOR[SYMMETRIC[REAL]] SIGMAS

Through a loop I can assign and recover single scalars and SYMMETRIC matrices from MVOLATS.

I believe it is more efficient to use the VECTOR[SYMMETRIC[REAL]] object, but have not found the way to assign or recover each SYMMETRIC matrix component or any single scalar from and to the VECTOR[SYMMETRIC[REAL]] object.

Could you please point me out on how to declare, assign and recover single scalars and msymmetric matrices to and from a VECTOR[SYMMETRIC[REAL]] object?

I appreciate very much your help.

Regards,

JMJulio.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Assigning values and obtaining information from ARRAYS

Unread post by TomDoan »

If you have a VECT[SYMM] called myvs, then

myvs(k) is the kth symmetric matrix and

myvs(k)(i,j) is the i,j element of the k's symmetric matrix.
jjulioro
Posts: 8
Joined: Mon Sep 07, 2015 3:36 pm

Re: Assigning values and obtaining information from ARRAYS

Unread post by jjulioro »

Great!

Thank you.

Is there anywhere else I can read about how theses objects work?

Regards,


JMJulio
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Assigning values and obtaining information from ARRAYS

Unread post by TomDoan »

Not really. The VECT[SERIES] (RECT[SERIES], SYMM[SERIES]) tend to be more natural. SERIES[VECT], SERIES[RECT], SERIES[SYMM] get used more when you need to manipulate the full matrices---however, with the %XT function, you can easily pull out a time-slice from a matrix[SERIES], so there isn't that big an advantage to the SERIES[matrix] arrangement.
Post Reply