DCC Graphs help required

Discussions of ARCH, GARCH, and related models
mbfakhry
Posts: 10
Joined: Tue Jul 23, 2013 2:05 am

DCC Graphs help required

Unread post 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
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: DCC Graphs help required

Unread post 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.
mbfakhry
Posts: 10
Joined: Tue Jul 23, 2013 2:05 am

Re: DCC Graphs help required

Unread post 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
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: DCC Graphs help required

Unread post by TomDoan »

You're computing the correlation, but graphing the covariance? (which it appears you haven't computed yet)
mbfakhry
Posts: 10
Joined: Tue Jul 23, 2013 2:05 am

Re: DCC Graphs help required

Unread post 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
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: DCC Graphs help required

Unread post 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.
mbfakhry
Posts: 10
Joined: Tue Jul 23, 2013 2:05 am

Re: DCC Graphs help required

Unread post 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
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: DCC Graphs help required

Unread post by TomDoan »

You somehow got the parentheses wrong. Why don't you copy and paste out of my message instead of re-typing?
mbfakhry
Posts: 10
Joined: Tue Jul 23, 2013 2:05 am

Re: DCC Graphs help required

Unread post 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
Post Reply