Page 5 of 7
Re: Beginner problems in DCC-GARCH
Posted: Mon May 09, 2016 12:08 pm
by TomDoan
You would have to post your program and data for us to diagnose that. However
- That isn't much data for a model that complicated
- Monthly data tends to have fairly weak GARCH effects, and a "spillover" model doesn't make sense unless those are fairly strong.
Have you looked at whether univariate GARCH models seem to work OK?
Re: Beginner problems in DCC-GARCH
Posted: Mon May 09, 2016 12:34 pm
by power23
yieldcurves.RPF
data4.txt
Dear Tom
Thanks for the help..Maybe I have to reestimate the model with daily data..The univariate garch is ok but I want also the dynamic correlations. I tried to use the formula on a daily dataset, with many more observations but again the program operates until the 4th variable..if I add more it closes down
I attached you my files
Thanks for the support
V
Re: Beginner problems in DCC-GARCH
Posted: Mon May 09, 2016 1:28 pm
by TomDoan
Your univariate GARCH models are really
not OK.
Code: Select all
garch(reg) / uk
# constant uk{1}
GARCH Model - Estimation by BFGS
Convergence in 43 Iterations. Final criterion was 0.0000006 <= 0.0000100
Dependent Variable UK
Monthly Data From 1994:04 To 2014:03
Usable Observations 240
Log Likelihood 308.9711
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Constant 0.003897143 0.004533031 0.85972 0.38994277
2. UK{1} 0.975882682 0.008232660 118.53795 0.00000000
3. C 0.004473508 0.000395925 11.29888 0.00000000
4. A -0.093260147 0.013802750 -6.75664 0.00000000
5. B 0.112953075 0.043399373 2.60264 0.00925082
(Others look similar). There are just no discernible GARCH properties in the data at that frequency so there's very little chance that you will get any reasonable model out of a complicated MV-GARCH. Note, BTW, that you put a NOPRINT on the GARCH instruction. Don't do that. The model doesn't even converge.
Re: Beginner problems in DCC-GARCH
Posted: Thu May 12, 2016 12:39 pm
by power23
Hi Tom!
you had right! my sample was not good.. I collected daily data and I think that both DCC and univariate garch model work well
I attached you the file
can you help me about the correlation and volatility graphs?if I they can be created by a command instead of giving a specific command to each variable
thanks a lot!
V
Re: Beginner problems in DCC-GARCH
Posted: Thu May 12, 2016 1:55 pm
by TomDoan
It's certainly more promising, though you're still not getting convergence:
MV-DCC GARCH with Spillover Variances - Estimation by BFGS
NO CONVERGENCE IN 67 ITERATIONS
LAST CRITERION WAS 0.0000000
SUBITERATIONS LIMIT EXCEEDED.
ESTIMATION POSSIBLY HAS STALLED OR MACHINE ROUNDOFF IS MAKING FURTHER PROGRESS DIFFICULT
TRY HIGHER SUBITERATIONS LIMIT, TIGHTER CVCRIT, DIFFERENT SETTING FOR EXACTLINE OR ALPHA ON NLPAR
RESTARTING ESTIMATION FROM LAST ESTIMATES OR DIFFERENT INITIAL GUESSES MIGHT ALSO WORK
(There's a reason that's in CAPITALS). You may need to do some preliminary simplex iterations. However, 7 variable models with VARIANCES=SPILLOVER can be tough to get to converge regardless.
Regarding the graphs, these:
Code: Select all
set hca %regstart() %regend() = hh(t)(1,1)
set cavol = sqrt(hca)
GRAPH(STYLE=LINE,HEADER="Canada") 1
# cavol 1999:02:01 2016:10:05
set hfr %regstart() %regend() = hh(t)(2,2)
set frvol = sqrt(hfr)
GRAPH(STYLE=LINE,HEADER="France") 1
# frvol 1999:02:01 2016:10:05
set hgm %regstart() %regend() = hh(t)(3,3)
set gmvol = sqrt(hgm)
GRAPH(STYLE=LINE,HEADER="Germany") 1
# gmvol 1999:02:01 2016:10:05
set hit %regstart() %regend() = hh(t)(4,4)
set itvol = sqrt(hit)
GRAPH(STYLE=LINE,HEADER="Italy") 1
# itvol 1999:02:01 2016:10:05
set hjp %regstart() %regend() = hh(t)(5,5)
set jpvol = sqrt(hjp)
GRAPH(STYLE=LINE,HEADER="Japan") 1
# jpvol 1999:02:01 2016:10:05
set huk %regstart() %regend() = hh(t)(6,6)
set ukvol = sqrt(huk)
GRAPH(STYLE=LINE,HEADER="UK") 1
# ukvol 1999:02:01 2016:10:05
set hus %regstart() %regend() = hh(t)(7,7)
set usvol = sqrt(hus)
GRAPH(STYLE=LINE,HEADER="US") 1
# usvol 1999:02:01 2016:10:05
really only differ in the header string and the subscript that they use (the names of the series really don't matter much). So you can clean those up with something like
Code: Select all
dec vect[strings] glabels
compute glabels=||"Canada","France", (etc.)||
do i=1,7
set htemp %regstart() %regend() = hh(t)(i,i)
set voltemp = sqrt(htemp)
graph(style=line,header=glabels(i))
# voltemp 1999:02:01 2016:10:05
end do i
(If the intent is to graph over the whole range, get rid of the explicit range on the # voltemp ... line. That way if you change the data, you won't have to remember to change that as well).
Do you know about split I/O windows? It looks like it will be quite a task to disentangle your instructions from the output in the above.
Re: Beginner problems in DCC-GARCH
Posted: Thu May 12, 2016 3:14 pm
by power23
thanks Tom!
I tried I/O split which is very helpful!
I applied different variance specifications rather than spillover, but I have still no convergence..Is there any example about how to implement preliminary simplex iterations?
thanks also for the volatiltiy graphs...is it a similar code for correlations?
for "set corr_ad %regstart() %regend() = %cvtocorr(hh(t))(1,2)
GRAPH(STYLE=LINE,HEADER="DCC:Canada-France") 1
# corr_ad 1999:02:01 2016:10:05"
because it has to be created 21 graphs for the pairs
thanks once again!
V
Re: Beginner problems in DCC-GARCH
Posted: Thu May 12, 2016 4:07 pm
by TomDoan
power23 wrote:thanks Tom!
I tried I/O split which is very helpful!
I applied different variance specifications rather than spillover, but I have still no convergence..Is there any example about how to implement preliminary simplex iterations?
Unfortunately, there isn't much I can say. When you get up to seven variables, the VARIANCES=SPILLOVER (and VARIANCES=VARMA as well) get very hard to fit. This is from the help description for VARIANCES=VARMA:
Note that VARIANCES=VARMA is rather difficult model to fit which is why we use some rather high-end adjustments to the non-linear estimation process using NLPAR. It has numerical problems because the coefficients can be either positive or negative as you can see below. (If you try to impose non-negativity, the model fits only barely better than the model without the cross variable terms). If high residual or high volatility entries don't align very well among variables, a variance for some variable can approach zero at some observation. For instance, here A(2,3) is fairly large negative, so a very big residual in the Swiss data (variable 3) might push the variance of France (variable) 2 negative in the next entry. Any zero (or negative) value for H at any data point results in an uncomputable likelihood resulting in quite a few "dead-end" parameter paths, where you approach a local maximum near a computability boundary. The more dissimilar the data series are, the harder it will be to get estimates with VARMA variances.
power23 wrote:
thanks also for the volatiltiy graphs...is it a similar code for correlations?
for "set corr_ad %regstart() %regend() = %cvtocorr(hh(t))(1,2)
GRAPH(STYLE=LINE,HEADER="DCC:Canada-France") 1
# corr_ad 1999:02:01 2016:10:05"
because it has to be created 21 graphs for the pairs
Code: Select all
do i=1,7
do j=1,i-1
set corrtemp %regstart() %regend() = %cvtocorr(hh(t))(i,j)
graph(style=line,header="DCC:"+glabels(i)+glabels(j)) 1
# corrtemp
end do j
end do i
Re: Beginner problems in DCC-GARCH
Posted: Thu Jun 30, 2016 11:06 pm
by debbysoraya
Hi anyonem
Right now I try to implement bivariate dcc garch developed by engle (2002).
So what I want to do is analyzing the conditional correlation between two countries using bivariate dcc. (using market indicies in the X and Y, terms of return already)
1. In the literature that I read, sometimes they mention that I should pre white first before runninf my dcc estimation, does it mean that I need to do:
system(model=var1)
variables x y
lags 1
det constant
end(system)
?
2. I got a little confuse so when I want to run the code, should I use
a. GARCH(P=1,Q=1,MV=DCC,VARIANCES=SPILLOVER,rvectors =rr, hmatrices=hh,ROBUST,noprint) / X Y
my question for this one is that in the estima's instruction it says that for engle two step the feature can only be variances=simple or variance= exponential
Does it mean code that I use is garch(p=1,q=1,mv=dcc) / X Y will be enough or if the pre whitean mean including the var, and it will be garch(p=1,q=1,mv=dcc, model=var1) / X Y
OR
b. GARCH(P=1,Q=1,MV=DCC,REGRESSORS) / Lx Ly
# Constant Lx Ly (i got this from few early post from you in this thread
I dont understand in here why there has to be L, in front of the variable. Does it mean if I am doing my stock indices return in two countries my code supposed to be garch(p=1,q=1,mv=dcc, model=var1) / LX L Y ?
3. Actually the way you put order for terms variables X Y , does it matter?
Thanks a lot!!
Re: Beginner problems in DCC-GARCH
Posted: Fri Jul 01, 2016 11:01 am
by TomDoan
debbysoraya wrote:Hi anyonem
Right now I try to implement bivariate dcc garch developed by engle (2002).
So what I want to do is analyzing the conditional correlation between two countries using bivariate dcc. (using market indicies in the X and Y, terms of return already)
1. In the literature that I read, sometimes they mention that I should pre white first before runninf my dcc estimation, does it mean that I need to do:
system(model=var1)
variables x y
lags 1
det constant
end(system)
With just two variables, there is no good reason not to do a joint estimate. What you're describing sounds like "3-step" estimator (pre-whiten, then univariate GARCH, then DCC). If there's a concern with serial correlation, you just use a VAR for the mean model.
debbysoraya wrote:
2. I got a little confuse so when I want to run the code, should I use
a. GARCH(P=1,Q=1,MV=DCC,VARIANCES=SPILLOVER,rvectors =rr, hmatrices=hh,ROBUST,noprint) / X Y
my question for this one is that in the estima's instruction it says that for engle two step the feature can only be variances=simple or variance= exponential
Does it mean code that I use is garch(p=1,q=1,mv=dcc) / X Y will be enough or if the pre whitean mean including the var, and it will be garch(p=1,q=1,mv=dcc, model=var1) / X Y
OR
b. GARCH(P=1,Q=1,MV=DCC,REGRESSORS) / Lx Ly
# Constant Lx Ly (i got this from few early post from you in this thread
I dont understand in here why there has to be L, in front of the variable. Does it mean if I am doing my stock indices return in two countries my code supposed to be garch(p=1,q=1,mv=dcc, model=var1) / LX L Y ?
Please note that the original questions in the thread were from someone who was setting up the model incorrectly, so you don't want to pay too much attention to what was being done. I don't know what your "X" and "Y" variables are. Typically, however, the series that are modeled using GARCH are in the form of returns or percentage changes or something like that. If X and Y aren't in the proper form for a GARCH, transform them. The
GARCHMV.RPF does a large number of different models, including one with a VAR(1) for the mean. In that case, it's a BEKK for the variance, but you can use DCC or any other multivariate GARCH option.
debbysoraya wrote:
3. Actually the way you put order for terms variables X Y , does it matter?
For MV=TBEKK and MV=CHOLESKY, yes. For all others, no.
Re: Beginner problems in DCC-GARCH
Posted: Fri Jul 01, 2016 7:25 pm
by debbysoraya
Thanks lot for your help Tom! I have few more question
TomDoan wrote:
With just two variables, there is no good reason not to do a joint estimate. What you're describing sounds like "3-step" estimator (pre-whiten, then univariate GARCH, then DCC). If there's a concern with serial correlation, you just use a VAR for the mean model.
So you suggest I just do garch(p=1,q=1,mv=dcc) / X Y ?
There is one other thing,
so the paper that I follow (the method)
r_t=γ_0 + γ_1 r_(t-1)+ γ_2 r_(t-1)^us + ε_t
the author us AR (1) process in the mean equation
for instance if I am doing DCC Garch between france and US,
the return equation for france at time t = constant + france return ar(1) + US return ar(1)
I looked the user guide and the code for multivariate including ar(1) process will give me only the ar(1) process for the return.
In my case they they will give me mean equation : france return at time t = constant + france return ar(1)
without the US return ar(1)
So what I put in the code is
Code: Select all
system(model=ar1)
variables rus rfr
lags 1
det constant
end(system)
*
garch(p=1, q=1, model=ar1, mv=dcc, pmethod=simplex, hmatrices=hd, rvectors=rd, piters=10)
is this correct?
Re: Beginner problems in DCC-GARCH
Posted: Fri Jul 01, 2016 7:37 pm
by TomDoan
debbysoraya wrote:Thanks lot for your help Tom! I have few more question
TomDoan wrote:
With just two variables, there is no good reason not to do a joint estimate. What you're describing sounds like "3-step" estimator (pre-whiten, then univariate GARCH, then DCC). If there's a concern with serial correlation, you just use a VAR for the mean model.
So you suggest I just do garch(p=1,q=1,mv=dcc) / X Y ?
No. That would only be appropriate if there were no serial correlation in the series. It sounds like you need some dynamics in the mean model. It's just that it makes more sense to include the dynamics of the mean directly into the estimates instead of "prewhitening" and using the residuals only.
debbysoraya wrote:
There is one other thing,
so the paper that I follow (the method)
r_t=γ_0 + γ_1 r_(t-1)+ γ_2 r_(t-1)^us + ε_t
the author us AR (1) process in the mean equation
for instance if I am doing DCC Garch between france and US,
the return equation for france at time t = constant + france return ar(1) + US return ar(1)
I looked the user guide and the code for multivariate including ar(1) process will give me only the ar(1) process for the return.
In my case they they will give me mean equation : france return at time t = constant + france return ar(1)
without the US return ar(1)
So what I put in the code is
Code: Select all
system(model=ar1)
variables rus rfr
lags 1
det constant
end(system)
*
garch(p=1, q=1, model=ar1, mv=dcc, pmethod=simplex, hmatrices=hd, rvectors=rd, piters=10)
is this correct?
That would be described as an VAR(1)-GARCH model (which is a common choice). AR(1) would just have lagged own variables and not the cross lags---there's another example in the GARCHMV example which sets up an AR(1) multivariate model. I would think that unless there's a compelling theoretical reason to include only own lags that you would do a full VAR.
Re: Beginner problems in DCC-GARCH
Posted: Fri Jul 01, 2016 8:45 pm
by debbysoraya
TomDoan wrote:
No. That would only be appropriate if there were no serial correlation in the series. It sounds like you need some dynamics in the mean model. It's just that it makes more sense to include the dynamics of the mean directly into the estimates instead of "prewhitening" and using the residuals only.
I am just making sure, that your suggestion is:
Code: Select all
system(model=var1)
variables rus rfr
lags 1
det constant
end(system)
*
garch(p=1, q=1, model=var1, mv=dcc, pmethod=simplex, hmatrices=hd, rvectors=rd, piters=10)
so that there is no serial correlation, isn't it
I attached the paper that I was talking about, the method that the author explain is in line with your suggestion about changing it to VAR right?
Thanks for the speedy reply

Re: Beginner problems in DCC-GARCH
Posted: Sun Jul 03, 2016 3:10 pm
by TomDoan
What they're doing is including lagged US (and only lagged US) in equations which are otherwise just own first lag. To do the same basic idea with your model, you would do
equation useq rus
# constant rus{1}
equation freq rfr
# constant rus{1} rfr{1}
group chiang useq freq
then use model=chiang on the GARCH instruction. Note that they're doing a model with a much larger number of countries, so the difference between their restricted mean model and a full VAR is quite substantial. The difference in your case is that rfr{1} is left out of the first equation.
Re: Beginner problems in DCC-GARCH
Posted: Sun Jul 03, 2016 6:05 pm
by debbysoraya
Dear Tom,
So, I try to do
Code: Select all
equation useq rus
# constant rus{1}
equation hkeq rhk
# constant rus{1} rhk{1}
group chiang useq hkeq
system(model=chiang)
variables rus rhk
lags 1
det constant
end(system)
nlpar(derive=fourth,exactline)
garch(p=1, q=1, model=chiang, mv=dcc, pmethod=simplex, hmatrices=hd, rvectors=rd, piters=10,method=bfgs)
MV-DCC GARCH - Estimation by BFGS
NO CONVERGENCE IN 5 ITERATIONS
LAST CRITERION WAS 0.0000000
ESTIMATION POSSIBLY HAS STALLED OR MACHINE ROUNDOFF IS MAKING FURTHER PROGRESS DIFFICULT
TRY HIGHER SUBITERATIONS LIMIT, TIGHTER CVCRIT, DIFFERENT SETTING FOR EXACTLINE OR ALPHA ON NLPAR
RESTARTING ESTIMATION FROM LAST ESTIMATES OR DIFFERENT INITIAL GUESSES MIGHT ALSO WORK
Usable Observations 141
Log Likelihood NA
Variable Coeff Std Error T-Stat Signif
*************************************************************************************
Mean Model(RUS)
1. RUS{1} -0.266842942 0.073876748 -3.61200 0.00030384
2. RHK{1} 0.002148003 0.052616399 0.04082 0.96743634
3. Constant -0.003494269 0.002349283 -1.48738 0.13691528
Mean Model(RHK)
4. RUS{1} 0.419572319 0.060280346 6.96035 0.00000000
5. RHK{1} -0.102680392 0.057070192 -1.79919 0.07198788
6. Constant 0.000304954 0.002199038 0.13868 0.88970629
7. C(1) 0.000309377 0.000037936 8.15516 0.00000000
8. C(2) 0.000346090 0.000043538 7.94914 0.00000000
9. A(1) 0.064674384 0.023771896 2.72062 0.00651589
10. A(2) 0.087341894 0.018855549 4.63216 0.00000362
11. B(1) 0.643978882 0.032544430 19.78768 0.00000000
12. B(2) 0.505183581 0.041534006 12.16313 0.00000000
13. DCC(A) -0.000000002 0.022157998 -9.19700e-008 0.99999993
14. DCC(B) 0.691813325 5.126186778 0.13496 0.89264610
There is a convergence problem. I looked up the thread and it says that if I encounter this problem I should either times the data by 100 or use the nlpar.
I tried nlpar for bhhh and bfgs, it is not working
I tried *100 , it is only working for bhhh (and I am not sure I can use this since I also apply bekk model in my dissertation using bfgs, is that okay if I use bfgs for the bekk and bhhh for dcc). My model is only bivariate I am not sure why I got this problem (is the number of observation matter?)
any suggestion?
Thanks
Re: Beginner problems in DCC-GARCH
Posted: Mon Jul 11, 2016 7:29 am
by annzhu
Dear Tom
I'm working with DCC-GARCH (1,1) model. Before estimating the model i'm running a bivariate VAR model to get residuals to use them as inputs for the DCC-model. But the problem is that don't get significant DCC parameters. Could you please suggest what could be the reason for insignificant parameters for DCC, and advise what i can do solve it?
The time series are stationary and do have ARCH effect.
Looking forward for your response.
Thank you very much!