Hello,
is the three-stage estimation method of the DCC-GARCH available, the addin has only the 2 step estimation method,
Help is much appreciated,
Dynamic conditional correlation multivariate GARCH
Moderators: EViews Gareth, EViews Moderator
-
arorasunita67
- Posts: 2
- Joined: Thu May 12, 2016 4:27 am
Re: Dynamic conditional correlation multivariate GARCH
You can consider this code. I used it last year for my research and you should be ok if using it for the bivariate. For trivariate u need to modify a litle bit especially for the log likelihood function.
Code: Select all
'change path to program path %path=@runpath cd %path 'load workfile containing the return series load nikkei_sp.WF1 'set sample range sample s1 1/06/1995 12/25/2007 scalar pi=3.14159 'defining the return series in terms of y1 and y2 series y1=r_nikkei series y2=r_sp 'fitting univariate GARCH(1,1) models to each of the two returns series equation eq_y1.arch(1,1,m=1000,h) y1 c equation eq_y2.arch(1,1,m=1000,h) y2 c 'extract the standardized residual series from the GARCH fit eq_y1.makeresids(s) z1 eq_y2.makeresids(s) z2 'extract garch series from univariate fit eq_y1.makegarch() garch1 eq_y2.makegarch() garch2 'Caculate sample variance of series z1, z2 and covariance of z1and z2 and correlation between z1 and z2 scalar var_z1=@var(z1) scalar var_z2=@var(z2) scalar cov_z1z2=@cov(z1,z2) scalar corr12=@cor(z1,z2) 'defining the starting values for the var(z1) var(z2) and covariance (z1,z2) series var_z1t=var_z1 series var_z2t=var_z2 series cov_z1tz2t=cov_z1z2 'declare the coefficient starting values coef(2) T T(1)=0.2 T(2)=0.7 ' ........................................................... ' LOG LIKELIHOOD for correlation part ' set up the likelihood ' 1) open a new blank likelihood object and name it 'dcc' ' 2) specify the log likelihood model by append ' ........................................................... logl dcc dcc.append @logl logl 'specify var_z1t, var_z2t, cov_z1tz2t dcc.append var_z1t=@nan(1-T(1)-T(2)+T(1)*(z1(-1)^2)+T(2)*var_z1t(-1),1) dcc.append var_z2t=@nan(1-T(1)-T(2)+T(1)*(z2(-1)^2)+T(2)*var_z2t(-1),1) dcc.append cov_z1tz2t=@nan((1-T(1)-T(2))*corr12+T(1)*z1(-1)*z2(-1)+T(2)*cov_z1tz2t(-1),1) dcc.append pen=(var_z1t<0)+(var_z2t<0) 'specify rho12 dcc.append rho12=cov_z1tz2t/@sqrt(@abs(var_z1t*var_z2t)) 'defining the determinant of correlation matrix and determinant of Dt dcc.append detrRt=(1-(rho12^2)) dcc.append detrDt=@sqrt(garch1*garch2) dcc.append pen=pen+(detrRt<0) dcc.append detrRt=@abs(detrRt) 'define the log likelihood function dcc.append logl=(-1/2)*(2*log(2*pi)+log(detrRt)+(z1^2+z2^2-2*rho12*z1*z2)/detrRt)-10*pen 'estimate the model smpl s1 dcc.ml(showopts, m=500, c=1e-5) 'display output and graphs show dcc.output graph corr.line rho12 show corr
-
arorasunita67
- Posts: 2
- Joined: Thu May 12, 2016 4:27 am
Re: Dynamic conditional correlation multivariate GARCH
Change your starting sample date from 3rd observation @lastThanks very much for sharing the code. I used this code for my research as well, it turned out that there is always an error box saying " Missing values in @LOGL series at current coefficients at observation 1 in 'DO_DCC.ML(SHOWOPTS, M=500,C=1E-5)' "
Could you guys tell me where went wrong? I will really appreciate your help ....
so sad ....
I want to say in program start your sample from 3rd observation to last
It worked for me
-
KHYATI KATHURIA
- Posts: 6
- Joined: Wed Jul 15, 2020 6:28 am
Re: Dynamic conditional correlation multivariate GARCH
Yes it is working starting with 3rd observation. Thank you Sunita mam.
Regards
Khyati Kathuria
Regards
Khyati Kathuria
-
KHYATI KATHURIA
- Posts: 6
- Joined: Wed Jul 15, 2020 6:28 am
Re: Dynamic conditional correlation multivariate GARCH
But mam when I am using the codes of ADCC Model by Cappiello et al (2006), they are giving an error message,"Missing values in @LOGL series at current coefficients at observation 2/01/2003 in "DO_ DCC.ML(B, SHOWOPTS,
M=1000, C=1E-5", How do I resolve it?
Best
Khyati
M=1000, C=1E-5", How do I resolve it?
Best
Khyati
Re: Dynamic conditional correlation multivariate GARCH
Hi. I am using this code by Hvtcapollo for a DCC-GARCH model. I am thereafter trying to use a term from the model (the pairwise dcc) to regress an equation such as p(ij,t) = y0 +y1Dcovid where Dcovid is a dummy. What I am not sure about is how to get this term(pairwise dcc, or p in this equation) or which step it is in the code:
[co'change path to program path
%path=@runpath
cd %path
'load workfile containing the return series
load nikkei_sp.WF1
'set sample range
sample s1 1/04/2017 01/04/2020
scalar pi=3.14159
'defining the return series in terms of y1 and y2
series y1=ret_btc
series y2=r_jse
'fitting univariate GARCH(1,1) models to each of the two returns series
equation eq_y1.arch(1,1,m=1000,h) y1 c
equation eq_y2.arch(1,1,m=1000,h) y2 c
'extract the standardized residual series from the GARCH fit
eq_y1.makeresids(s) z1
eq_y2.makeresids(s) z2
'extract garch series from univariate fit
eq_y1.makegarch() garch1
eq_y2.makegarch() garch2
'Caculate sample variance of series z1, z2 and covariance of z1and z2 and correlation between z1 and z2
scalar var_z1=@var(z1)
scalar var_z2=@var(z2)
scalar cov_z1z2=@cov(z1,z2)
scalar corr12=@cor(z1,z2)
'defining the starting values for the var(z1) var(z2) and covariance (z1,z2)
series var_z1t=var_z1
series var_z2t=var_z2
series cov_z1tz2t=cov_z1z2
'declare the coefficient starting values
coef(2) T
T(1)=0.2
T(2)=0.7
' ...........................................................
' LOG LIKELIHOOD for correlation part
' set up the likelihood
' 1) open a new blank likelihood object and name it 'dcc'
' 2) specify the log likelihood model by append
' ...........................................................
logl dcc
dcc.append @logl logl
'specify var_z1t, var_z2t, cov_z1tz2t
dcc.append var_z1t=@nan(1-T(1)-T(2)+T(1)*(z1(-1)^2)+T(2)*var_z1t(-1),1)
dcc.append var_z2t=@nan(1-T(1)-T(2)+T(1)*(z2(-1)^2)+T(2)*var_z2t(-1),1)
dcc.append cov_z1tz2t=@nan((1-T(1)-T(2))*corr12+T(1)*z1(-1)*z2(-1)+T(2)*cov_z1tz2t(-1),1)
dcc.append pen=(var_z1t<0)+(var_z2t<0)
'specify rho12
dcc.append rho12=cov_z1tz2t/@sqrt(@abs(var_z1t*var_z2t))
'defining the determinant of correlation matrix and determinant of Dt
dcc.append detrRt=(1-(rho12^2))
dcc.append detrDt=@sqrt(garch1*garch2)
dcc.append pen=pen+(detrRt<0)
dcc.append detrRt=@abs(detrRt)
'define the log likelihood function
dcc.append logl=(-1/2)*(2*log(2*pi)+log(detrRt)+(z1^2+z2^2-2*rho12*z1*z2)/detrRt)-10*pen
'estimate the model
smpl s1
dcc.ml(showopts, m=500, c=1e-5)
'display output and graphs
show dcc.output
graph corr.line rho12
show corrde][/code]
[co'change path to program path
%path=@runpath
cd %path
'load workfile containing the return series
load nikkei_sp.WF1
'set sample range
sample s1 1/04/2017 01/04/2020
scalar pi=3.14159
'defining the return series in terms of y1 and y2
series y1=ret_btc
series y2=r_jse
'fitting univariate GARCH(1,1) models to each of the two returns series
equation eq_y1.arch(1,1,m=1000,h) y1 c
equation eq_y2.arch(1,1,m=1000,h) y2 c
'extract the standardized residual series from the GARCH fit
eq_y1.makeresids(s) z1
eq_y2.makeresids(s) z2
'extract garch series from univariate fit
eq_y1.makegarch() garch1
eq_y2.makegarch() garch2
'Caculate sample variance of series z1, z2 and covariance of z1and z2 and correlation between z1 and z2
scalar var_z1=@var(z1)
scalar var_z2=@var(z2)
scalar cov_z1z2=@cov(z1,z2)
scalar corr12=@cor(z1,z2)
'defining the starting values for the var(z1) var(z2) and covariance (z1,z2)
series var_z1t=var_z1
series var_z2t=var_z2
series cov_z1tz2t=cov_z1z2
'declare the coefficient starting values
coef(2) T
T(1)=0.2
T(2)=0.7
' ...........................................................
' LOG LIKELIHOOD for correlation part
' set up the likelihood
' 1) open a new blank likelihood object and name it 'dcc'
' 2) specify the log likelihood model by append
' ...........................................................
logl dcc
dcc.append @logl logl
'specify var_z1t, var_z2t, cov_z1tz2t
dcc.append var_z1t=@nan(1-T(1)-T(2)+T(1)*(z1(-1)^2)+T(2)*var_z1t(-1),1)
dcc.append var_z2t=@nan(1-T(1)-T(2)+T(1)*(z2(-1)^2)+T(2)*var_z2t(-1),1)
dcc.append cov_z1tz2t=@nan((1-T(1)-T(2))*corr12+T(1)*z1(-1)*z2(-1)+T(2)*cov_z1tz2t(-1),1)
dcc.append pen=(var_z1t<0)+(var_z2t<0)
'specify rho12
dcc.append rho12=cov_z1tz2t/@sqrt(@abs(var_z1t*var_z2t))
'defining the determinant of correlation matrix and determinant of Dt
dcc.append detrRt=(1-(rho12^2))
dcc.append detrDt=@sqrt(garch1*garch2)
dcc.append pen=pen+(detrRt<0)
dcc.append detrRt=@abs(detrRt)
'define the log likelihood function
dcc.append logl=(-1/2)*(2*log(2*pi)+log(detrRt)+(z1^2+z2^2-2*rho12*z1*z2)/detrRt)-10*pen
'estimate the model
smpl s1
dcc.ml(showopts, m=500, c=1e-5)
'display output and graphs
show dcc.output
graph corr.line rho12
show corrde][/code]
Re: Dynamic conditional correlation multivariate GARCH
Hi!
How to generate DCC-based conditional covariances in Eviews? I have to generate the DCC-based covariance matrix between the individual stock and the market portfolio. Are we supposed to use the drop-down or codes? Kindly help me out with it.
Thank you.
How to generate DCC-based conditional covariances in Eviews? I have to generate the DCC-based covariance matrix between the individual stock and the market portfolio. Are we supposed to use the drop-down or codes? Kindly help me out with it.
Thank you.
Who is online
Users browsing this forum: No registered users and 2 guests
