Page 1 of 1

DCC Graphs help required

Posted: Fri Sep 06, 2013 10:05 am
by mbfakhry
Dear sir or madam,

I am using the following:

GARCH(P=1,Q=1,MV=DCC,RVECTORS=RR,HMATRICES=HH) * 2007:12:31 ADPRICE DDPRCE FDPRICE GDPRICE IDPRICE PDPRICE

I know that HH gives me the Covariance matrix which allows me to access the covariance to plot the graph.

for example:
SET cov_ad 1 1435 =hh(t)(1,2)
GRAPH(STYLE=LINE, HEADER="Covariance of US with Germany") 1
# cov_ad 1 1435

I was wondering if there is a similar option for the dynamic correlation. If not can i use the following example to calculate the dynamic correlations:

SET corr_ad 1 1435 = hh(t)(1,2)/SQRT(hh(t)(1,1)*hh(t)(2,2))

Or what do I have to do to get to the Dynamic correlations.

Many Thanks,

Bachar

Re: DCC Graphs help required

Posted: Fri Sep 06, 2013 10:22 am
by TomDoan
Yes. That would be the simplest way to get the conditional correlations. The covariance matrix at T is obtained by combining the dynamic correlation matrix with the variances. What that SET instruction is doing is backing out the step of multiplying through by the square roots of the variances.

Re: DCC Graphs help required

Posted: Fri Sep 06, 2013 12:27 pm
by mbfakhry
Dear Tom,

Many Thanks for your help

Let me just make sure that I understood the procedure correctly.
GARCH(P=1,Q=1,MV=DCC,RVECTORS=RR,HMATRICES=HH) * 2007:12:31 ADPRICE DDPRCE FDPRICE GDPRICE IDPRICE PDPRICE
SET corr_ad 1 1435 = hh(t)(1,2)/SQRT(hh(t)(1,1)*hh(t)(2,2))
GRAPH(STYLE=LINE, HEADER="Covariance of US with Germany") 1
# cov_ad 1 1435

Is that correct

Once again many thanks for your help.

Bachar

Re: DCC Graphs help required

Posted: Fri Sep 06, 2013 1:40 pm
by TomDoan
You're computing the correlation, but graphing the covariance? (which it appears you haven't computed yet)

Re: DCC Graphs help required

Posted: Fri Sep 06, 2013 2:01 pm
by mbfakhry
doh,

Idiot!! :oops:
sorry about that error that'll teach me to double check.

I meant to type:
GARCH(P=1,Q=1,MV=DCC,RVECTORS=RR,HMATRICES=HH) * 2007:12:31 ADPRICE DDPRCE FDPRICE GDPRICE IDPRICE PDPRICE
SET corr_ad 1 1435 = hh(t)(1,2)/SQRT(hh(t)(1,1)*hh(t)(2,2))
GRAPH(STYLE=LINE, HEADER="Correlation of US with Germany") 1
# corr_ad 1 1435

Many Thanks,

Bachar

Re: DCC Graphs help required

Posted: Fri Sep 06, 2013 2:09 pm
by TomDoan
mbfakhry wrote:doh,

Idiot!! :oops:
sorry about that error that'll teach me to double check.

I meant to type:
GARCH(P=1,Q=1,MV=DCC,RVECTORS=RR,HMATRICES=HH) * 2007:12:31 ADPRICE DDPRCE FDPRICE GDPRICE IDPRICE PDPRICE
SET corr_ad 1 1435 = hh(t)(1,2)/SQRT(hh(t)(1,1)*hh(t)(2,2))
GRAPH(STYLE=LINE, HEADER="Correlation of US with Germany") 1
# corr_ad 1 1435

Many Thanks,

Bachar
That should work (assuming the range is OK). A more flexible way to write that would be

set corr_ad %regstart() %regend() = %cvtocorr(hh(t))(1,2)
GRAPH(STYLE=LINE, HEADER="Correlation of US with Germany") 1
# corr_ad

That picks up the range of the GARCH instruction in %regstart() to %regend() so you don't have to figure it out yourself. And the %cvtocorr(...) is a bit simpler to read and modify for a different combination of countries.

Re: DCC Graphs help required

Posted: Fri Sep 06, 2013 2:50 pm
by mbfakhry
Dear Tom,

Thanks for the short cut but I keep getting the following error:

SET corr_ad %regstart() %regend() = %cvtocorr(hh(t)(1,2))
## SX22. Expected Type REAL, Got SYMMETRIC[REAL] Instead
>>>>tocorr(hh(t)(1,2))<<<<


Bachar

Re: DCC Graphs help required

Posted: Fri Sep 06, 2013 3:39 pm
by TomDoan
You somehow got the parentheses wrong. Why don't you copy and paste out of my message instead of re-typing?

Re: DCC Graphs help required

Posted: Fri Sep 06, 2013 3:59 pm
by mbfakhry
Dear Tom,

DOH idiot :oops:

Once again sorry for dumbness

It helps if you're not tired!! :D

Many thanks for the short cut

Thanks,

Bachar