Page 1 of 1

Assigning values and obtaining information from ARRAYS

Posted: Wed Feb 10, 2016 10:41 am
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.

Re: Assigning values and obtaining information from ARRAYS

Posted: Wed Feb 10, 2016 11:40 am
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.

Re: Assigning values and obtaining information from ARRAYS

Posted: Fri Feb 12, 2016 10:07 am
by jjulioro
Great!

Thank you.

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

Regards,


JMJulio

Re: Assigning values and obtaining information from ARRAYS

Posted: Mon Feb 15, 2016 11:35 am
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.