VAR E-GARCH with dummies
VAR E-GARCH with dummies
Dear Tom,
Is there a way to put a dummy of a set number of observations? For example, a dummy on observations 2000 to 4000.
In addition, I am running the alogrithm, but the initial values seem to be arbitrarily.
Thank you very much for your help and time. I greatly appreciate your help.
Eric
Is there a way to put a dummy of a set number of observations? For example, a dummy on observations 2000 to 4000.
In addition, I am running the alogrithm, but the initial values seem to be arbitrarily.
Thank you very much for your help and time. I greatly appreciate your help.
Eric
Last edited by Eric on Thu Aug 19, 2010 8:53 am, edited 5 times in total.
Re: VAR E-GARCH with dummies
It sounds as if the easiest way to deal with the dummy is to just create it in the spreadsheet and read it in. You can create the dummy in RATS with something like
I don't see where you labelled anything in the attachment. This is what calculates the variance:
If you just add a shift dummy to the variance, that would shift the variance up or down by a fixed percentage in the dummied out period. You could implement that by adding an extra n vector called, say, AD, and changing the compute hlog to
Include AD in the parameter set and initialize it to zeros.
If you want to shift the entire spillover effect, you might need to have a completely new set of coefficients governing the hlog calculation. At minimum, if you switch the "other" coefficients on lagged z's, you would have to also shift the constant in that calculation. To do a full set of shifts, you would create an AD and a GD with the same structure as A and G and compute hlog with
Zero guess values would be appropriate for AD and GD.
Code: Select all
set dummy = t>=3095.and.t<=4549Code: Select all
do i=1,n
compute hlog=a(i)(1)+g(i)*log(v(i)(t-1))
do j=1,n
compute hlog=hlog+a(i)(j+1)*z(j)(t-1)
end do j
compute v(i)(t) = exp(hlog)
compute u(i)(t) = r(i)(t)-e(i)(t)
end do iCode: Select all
compute hlog=a(i)(1)+ad(i)*dummy(t)+g(i)*log(v(i)(t-1))If you want to shift the entire spillover effect, you might need to have a completely new set of coefficients governing the hlog calculation. At minimum, if you switch the "other" coefficients on lagged z's, you would have to also shift the constant in that calculation. To do a full set of shifts, you would create an AD and a GD with the same structure as A and G and compute hlog with
Code: Select all
compute hlog=a(i)(1)+ad(i)(1)*dummy(t)+(g(i)+gd(i)*dummy(t))*log(v(i)(t-1))
do j=1,n
compute hlog=hlog+(a(i)(j+1)+ad(i)(j+1)*dummy(t))*z(j)(t-1)
end do jRe: VAR E-GARCH with dummies
Dear Tom,
I put the dummies into the varaince equation and try to run it, it gives me this message:
## SX22. Expected Type REAL, Got MATRIX(REAL) Instead
>>>>t))*log(v(i)(t-1))<<<<
Thanks again,
Eric
I put the dummies into the varaince equation and try to run it, it gives me this message:
## SX22. Expected Type REAL, Got MATRIX(REAL) Instead
>>>>t))*log(v(i)(t-1))<<<<
Thanks again,
Eric
Last edited by Eric on Thu Aug 19, 2010 8:53 am, edited 3 times in total.
Re: VAR E-GARCH with dummies
GD needs to be a VECTOR (just like G), not a VEC[VEC].
Re: VAR E-GARCH with dummies
Dear Tom,
Thank you for the reply, I figure that part out, but then it gives me a message saying:
## SX17. Missing Operator or Adjacent Operands
>>>>og = a(i)(1)+ad(i)(<<<<
In addition, I was wondering what the appropriate starting guess values for a,g,d could be?
Thanks again.
Eric
Thank you for the reply, I figure that part out, but then it gives me a message saying:
## SX17. Missing Operator or Adjacent Operands
>>>>og = a(i)(1)+ad(i)(<<<<
In addition, I was wondering what the appropriate starting guess values for a,g,d could be?
Thanks again.
Eric
Last edited by Eric on Thu Aug 19, 2010 8:54 am, edited 3 times in total.
Re: VAR E-GARCH with dummies
AD needs to have the same structure and dimensions as A; GD needs to have the same structure and dimensions as G. So you want the declaration to be:
and the initialization to be (inside the do i loop that does all the initializing):
compute ad(i) = %zeros(n+1,1)
If you're having a hard time getting convergence, you should start with a more modest model and work up. Leave AD and GD (and maybe D) out of the parameter set and try to get that to work. (They're all initialized to zero, so they won't enter the likelihood). Once you have that converged, it should be easier to estimate the model with the full parameter set.
V is a variance, so you want sqrt(v(1)(t)) in the denominator.
Code: Select all
dec vect[vect] a(n)
dec vect[vect] ad(n) ;*Dummy variablecompute ad(i) = %zeros(n+1,1)
If you're having a hard time getting convergence, you should start with a more modest model and work up. Leave AD and GD (and maybe D) out of the parameter set and try to get that to work. (They're all initialized to zero, so they won't enter the likelihood). Once you have that converged, it should be easier to estimate the model with the full parameter set.
Code: Select all
set residual1 = u(1)(t)/v(1)(t)Re: VAR E-GARCH with dummies
Dear Tom,
I have also run a DCC GARCH, however, when I try different sub sample. It gives me this mesasge and I am not sure how to solve this problem:
Covariance\Correlation Matrix
EPS(1) EPS(2)
EPS(1) 0.998319716 0.80582
EPS(2) 0.804753930 0.999040960
## MAT15. Subscripts Too Large or Non-Positive
Also, how do I plot the dynamic conditional correlation? It is on the last line of the codes attached to this message. I also tested the Tse test on constant correlation, however, how do I interpret the result? Is the result this:
Variable Coeff Std Error T-Stat Signif
8. XD(1,1) 11.613015 26.388156 0.44008 0.65988738
The null is constant correlation, so in this case, it does not reject the null. Therefore, it is constant correlated, am I right?
In addition, could you also please check to see if the codes for the VAR EGARCH are correct? I have two dummies in there. I think the part that is likely to be incorrect are the codes for the guess values.
I got it to converge for a VAR EGARCH without dummies with these values:
compute a(i)(1)=log(%seesq),a(i)(i+1)=0.005
compute g(i)=0.1,d(i)=0.0
MAXIMIZE - Estimation by BFGS
Convergence in 115 Iterations. Final criterion was 0.0000000 <= 0.0000100
119/Day of Undated Data From 1//002 To 71//048
Usable Observations 8377
Function Value 79598.02579012
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. B(1)(1) -0.000030242 0.000020299 -1.48986 0.13626167
2. B(1)(2) -0.129465959 0.015282317 -8.47162 0.00000000
3. B(1)(3) 0.055727675 0.015283359 3.64630 0.00026605
4. B(2)(1) -0.000046654 0.000018035 -2.58687 0.00968526
5. B(2)(2) 0.315357989 0.015787179 19.97558 0.00000000
6. B(2)(3) -0.325758223 0.014219375 -22.90946 0.00000000
7. A(1)(1) -0.173348099 0.002733146 -63.42438 0.00000000
8. A(1)(2) 0.026925475 0.009039565 2.97862 0.00289545
9. A(1)(3) 0.157284268 0.008584217 18.32249 0.00000000
10. A(2)(1) -0.212071208 0.007158110 -29.62670 0.00000000
11. A(2)(2) 0.023920572 0.010466654 2.28541 0.02228894
12. A(2)(3) 0.201228796 0.011548475 17.42471 0.00000000
13. D(1) -0.472199948 0.026946636 -17.52352 0.00000000
14. D(2) 0.043384791 0.032789689 1.32312 0.18579449
15. G(1) 0.984355309 0.000259782 3789.16465 0.00000000
16. G(2) 0.980888094 0.000624941 1569.56832 0.00000000
17. RR(1,1) 0.806548941 0.002746315 293.68410 0.00000000
Correlations of Series RESIDUAL1
119/Day of Undated Data From 1//001 To 71//048
Autocorrelations
1 2 3 4 5 6 7 8 9 10
0.02440 -0.00367 0.02023 0.00817 0.00838 -0.00331 0.00457 -0.00509 0.00582 0.00870
11 12
0.00239 0.01534
Ljung-Box Q-Statistics
Lags Statistic Signif Lvl
4 9.090 0.058884
8 10.163 0.253768
12 13.106 0.361368
Correlations of Series RESIDUAL1SQ
119/Day of Undated Data From 1//001 To 71//048
Autocorrelations
1 2 3 4 5 6 7 8 9 10
0.06992 0.01299 0.03223 0.00474 0.00142 0.00144 -0.01240 0.00766 -0.00536 -0.00593
11 12
0.00362 -0.00898
Ljung-Box Q-Statistics
Lags Statistic Signif Lvl
4 51.282 0.000000
8 53.098 0.000000
12 54.421 0.000000
However, the squared residuals are highly significant. I am hoping that the dummies would make the squared residuals not significant, but I cannot get the VAR EGARCH with dummies to converge. Could you please give me some guidance on how I should approach this?
Thank you so much for your help and time!
Kind Regards,
Eric
I have also run a DCC GARCH, however, when I try different sub sample. It gives me this mesasge and I am not sure how to solve this problem:
Covariance\Correlation Matrix
EPS(1) EPS(2)
EPS(1) 0.998319716 0.80582
EPS(2) 0.804753930 0.999040960
## MAT15. Subscripts Too Large or Non-Positive
Also, how do I plot the dynamic conditional correlation? It is on the last line of the codes attached to this message. I also tested the Tse test on constant correlation, however, how do I interpret the result? Is the result this:
Variable Coeff Std Error T-Stat Signif
8. XD(1,1) 11.613015 26.388156 0.44008 0.65988738
The null is constant correlation, so in this case, it does not reject the null. Therefore, it is constant correlated, am I right?
In addition, could you also please check to see if the codes for the VAR EGARCH are correct? I have two dummies in there. I think the part that is likely to be incorrect are the codes for the guess values.
I got it to converge for a VAR EGARCH without dummies with these values:
compute a(i)(1)=log(%seesq),a(i)(i+1)=0.005
compute g(i)=0.1,d(i)=0.0
MAXIMIZE - Estimation by BFGS
Convergence in 115 Iterations. Final criterion was 0.0000000 <= 0.0000100
119/Day of Undated Data From 1//002 To 71//048
Usable Observations 8377
Function Value 79598.02579012
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. B(1)(1) -0.000030242 0.000020299 -1.48986 0.13626167
2. B(1)(2) -0.129465959 0.015282317 -8.47162 0.00000000
3. B(1)(3) 0.055727675 0.015283359 3.64630 0.00026605
4. B(2)(1) -0.000046654 0.000018035 -2.58687 0.00968526
5. B(2)(2) 0.315357989 0.015787179 19.97558 0.00000000
6. B(2)(3) -0.325758223 0.014219375 -22.90946 0.00000000
7. A(1)(1) -0.173348099 0.002733146 -63.42438 0.00000000
8. A(1)(2) 0.026925475 0.009039565 2.97862 0.00289545
9. A(1)(3) 0.157284268 0.008584217 18.32249 0.00000000
10. A(2)(1) -0.212071208 0.007158110 -29.62670 0.00000000
11. A(2)(2) 0.023920572 0.010466654 2.28541 0.02228894
12. A(2)(3) 0.201228796 0.011548475 17.42471 0.00000000
13. D(1) -0.472199948 0.026946636 -17.52352 0.00000000
14. D(2) 0.043384791 0.032789689 1.32312 0.18579449
15. G(1) 0.984355309 0.000259782 3789.16465 0.00000000
16. G(2) 0.980888094 0.000624941 1569.56832 0.00000000
17. RR(1,1) 0.806548941 0.002746315 293.68410 0.00000000
Correlations of Series RESIDUAL1
119/Day of Undated Data From 1//001 To 71//048
Autocorrelations
1 2 3 4 5 6 7 8 9 10
0.02440 -0.00367 0.02023 0.00817 0.00838 -0.00331 0.00457 -0.00509 0.00582 0.00870
11 12
0.00239 0.01534
Ljung-Box Q-Statistics
Lags Statistic Signif Lvl
4 9.090 0.058884
8 10.163 0.253768
12 13.106 0.361368
Correlations of Series RESIDUAL1SQ
119/Day of Undated Data From 1//001 To 71//048
Autocorrelations
1 2 3 4 5 6 7 8 9 10
0.06992 0.01299 0.03223 0.00474 0.00142 0.00144 -0.01240 0.00766 -0.00536 -0.00593
11 12
0.00362 -0.00898
Ljung-Box Q-Statistics
Lags Statistic Signif Lvl
4 51.282 0.000000
8 53.098 0.000000
12 54.421 0.000000
However, the squared residuals are highly significant. I am hoping that the dummies would make the squared residuals not significant, but I cannot get the VAR EGARCH with dummies to converge. Could you please give me some guidance on how I should approach this?
Thank you so much for your help and time!
Kind Regards,
Eric
Last edited by Eric on Fri Jul 30, 2010 3:12 am, edited 1 time in total.
Re: VAR E-GARCH with dummies
When you do the SET instruction to get the standardized residuals, do it over the explicit range %regstart() to %regend(), that isEric wrote:Dear Tom,
I have also run a DCC GARCH, however, when I try different sub sample. It gives me this mesasge and I am not sure how to solve this problem:
Covariance\Correlation Matrix
EPS(1) EPS(2)
EPS(1) 0.998319716 0.80582
EPS(2) 0.804753930 0.999040960
## MAT15. Subscripts Too Large or Non-Positive
set ustd %regstart() %regend() = ...
The GARCHMV.PRG example graphs the conditional correlations. Your Tse test doesn't reject the null of constant correlation in favor of a specific alternative which is not DCC. You can test DCC vs CC by a standard LR test.Eric wrote: Also, how do I plot the dynamic conditional correlation? It is on the last line of the codes attached to this message. I also tested the Tse test on constant correlation, however, how do I interpret the result? Is the result this:
Variable Coeff Std Error T-Stat Signif
8. XD(1,1) 11.613015 26.388156 0.44008 0.65988738
The null is constant correlation, so in this case, it does not reject the null. Therefore, it is constant correlated, am I right?
As I suggested, you would be more likely to be successful by doing this incrementally. Zero out the AD's and GD's, then do:Eric wrote:In addition, could you also please check to see if the codes for the VAR EGARCH are correct? I have two dummies in there. I think the part that is likely to be incorrect are the codes for the guess values.
I got it to converge for a VAR EGARCH without dummies with these values:
compute a(i)(1)=log(%seesq),a(i)(i+1)=0.005
compute g(i)=0.1,d(i)=0.0
MAXIMIZE - Estimation by BFGS
Convergence in 115 Iterations. Final criterion was 0.0000000 <= 0.0000100
119/Day of Undated Data From 1//002 To 71//048
Usable Observations 8377
Function Value 79598.02579012
Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. B(1)(1) -0.000030242 0.000020299 -1.48986 0.13626167
2. B(1)(2) -0.129465959 0.015282317 -8.47162 0.00000000
3. B(1)(3) 0.055727675 0.015283359 3.64630 0.00026605
4. B(2)(1) -0.000046654 0.000018035 -2.58687 0.00968526
5. B(2)(2) 0.315357989 0.015787179 19.97558 0.00000000
6. B(2)(3) -0.325758223 0.014219375 -22.90946 0.00000000
7. A(1)(1) -0.173348099 0.002733146 -63.42438 0.00000000
8. A(1)(2) 0.026925475 0.009039565 2.97862 0.00289545
9. A(1)(3) 0.157284268 0.008584217 18.32249 0.00000000
10. A(2)(1) -0.212071208 0.007158110 -29.62670 0.00000000
11. A(2)(2) 0.023920572 0.010466654 2.28541 0.02228894
12. A(2)(3) 0.201228796 0.011548475 17.42471 0.00000000
13. D(1) -0.472199948 0.026946636 -17.52352 0.00000000
14. D(2) 0.043384791 0.032789689 1.32312 0.18579449
15. G(1) 0.984355309 0.000259782 3789.16465 0.00000000
16. G(2) 0.980888094 0.000624941 1569.56832 0.00000000
17. RR(1,1) 0.806548941 0.002746315 293.68410 0.00000000
Correlations of Series RESIDUAL1
119/Day of Undated Data From 1//001 To 71//048
Autocorrelations
1 2 3 4 5 6 7 8 9 10
0.02440 -0.00367 0.02023 0.00817 0.00838 -0.00331 0.00457 -0.00509 0.00582 0.00870
11 12
0.00239 0.01534
Ljung-Box Q-Statistics
Lags Statistic Signif Lvl
4 9.090 0.058884
8 10.163 0.253768
12 13.106 0.361368
Correlations of Series RESIDUAL1SQ
119/Day of Undated Data From 1//001 To 71//048
Autocorrelations
1 2 3 4 5 6 7 8 9 10
0.06992 0.01299 0.03223 0.00474 0.00142 0.00144 -0.01240 0.00766 -0.00536 -0.00593
11 12
0.00362 -0.00898
Ljung-Box Q-Statistics
Lags Statistic Signif Lvl
4 51.282 0.000000
8 53.098 0.000000
12 54.421 0.000000
However, the squared residuals are highly significant. I am hoping that the dummies would make the squared residuals not significant, but I cannot get the VAR EGARCH with dummies to converge. Could you please give me some guidance on how I should approach this?
Thank you so much for your help and time!
Please find the code attached to this mesage.
Kind Regards,
Eric
Code: Select all
nonlin b a d g rr
maximize(pmethod=simplex,piters=10,method=bfgs,trace,iters=1000) Lt start+1 end
nonlin b a d g rr ad gd
maximize(method=bfgs,trace,iters=1000) Lt start+1 end
nonlin b a d g rr ad adtwo gd gdtwo
maximize(method=bfgs,trace,iters=1000) Lt start+1 endRe: VAR E-GARCH with dummies
Dear Tom,
I think I am plotting the conditional correlation, could you please check if I am doing the right thing? In addition, I am unsure what you mean by specific range? In the last message you said:
set ustd %regstart() %regend() = ...
However, I do not have ustd and if what I should change is this line:
gset uu %regstart() %regend() = %outerxx(%xt(eps,t))
I am not sure how to set the range explicitly.
Here is the code for the dcc garch:
*
*
dec vect[series] eps(n)
dec vect fullbeta(4*n+2)
*
* Do univariate GARCH models. Save the standardized residuals
* into eps(i). Copy the coefficients into the proper slots in
* the full beta matrix.
*
do i=1,n
garch(p=1,q=1,resids=r,hseries=h) / x(i)
set eps(i) = r/sqrt(h)
do j=1,4
compute fullbeta(n*(j-1)+i)=%beta(j)
end do j
end do i
*
* Compute the covariance matrix of the standardized residuals
*
vcv(matrix=rr)
# eps
*
* Create the series[symm] uu (outer product of residuals). Make
* it the unconditional value prior to the sample.
*
dec series[symm] uu q
gset uu %regstart() %regend() = %outerxx(%xt(eps,t))
gset uu 1 %regstart()-1 = rr
gset q = rr
*
* Log likelihood for the DCC phase, taking the residuals as given
*
nonlin a b
dec frml[symm] qf
frml qf = (qx=(1-a-b)*rr+a*uu{1}+b*q{1})
frml logl = q=qf,%logdensity(%cvtocorr(q),%xt(eps,t))
compute b=.80,a=.10
maximize logl 2 *
*
* Compute the estimates into the final two slots in fullbeta
*
compute fullbeta(4*n+1)=%beta(1),fullbeta(4*n+2)=%beta(2)
*
* Do one iteration of the full model with METHOD=BHHH to get
* the grand covariance matrix.
*
garch(p=1,q=1,mv=dcc,method=bhhh,initial=fullbeta,iters=50,hmatrices=hh) / x
set residual1 = eps(1)
set residual1sq = residual1 (t)*residual1 (t)
*** Checking standardised residuals ***
cor(qstats,number=12,span=4) residual1
*** Checking squared standardised residuals ***
cor(qstats,number=12,span=4) residual1sq
In addition, for the VAR EGARCH model. I used the codes as suggested:
Am I missing something, there is a(i)(1)=log(%seesq), but I did not do that for the dummy?
It converges with b a d g rr ad gd as well, but not when I add adtwo and gdtwo. Does that mean I just need to adjust adtwo and gdtwo to make it converge?
Thank you so much for time and help.
Eric
I think I am plotting the conditional correlation, could you please check if I am doing the right thing? In addition, I am unsure what you mean by specific range? In the last message you said:
set ustd %regstart() %regend() = ...
However, I do not have ustd and if what I should change is this line:
gset uu %regstart() %regend() = %outerxx(%xt(eps,t))
I am not sure how to set the range explicitly.
Here is the code for the dcc garch:
*
*
dec vect[series] eps(n)
dec vect fullbeta(4*n+2)
*
* Do univariate GARCH models. Save the standardized residuals
* into eps(i). Copy the coefficients into the proper slots in
* the full beta matrix.
*
do i=1,n
garch(p=1,q=1,resids=r,hseries=h) / x(i)
set eps(i) = r/sqrt(h)
do j=1,4
compute fullbeta(n*(j-1)+i)=%beta(j)
end do j
end do i
*
* Compute the covariance matrix of the standardized residuals
*
vcv(matrix=rr)
# eps
*
* Create the series[symm] uu (outer product of residuals). Make
* it the unconditional value prior to the sample.
*
dec series[symm] uu q
gset uu %regstart() %regend() = %outerxx(%xt(eps,t))
gset uu 1 %regstart()-1 = rr
gset q = rr
*
* Log likelihood for the DCC phase, taking the residuals as given
*
nonlin a b
dec frml[symm] qf
frml qf = (qx=(1-a-b)*rr+a*uu{1}+b*q{1})
frml logl = q=qf,%logdensity(%cvtocorr(q),%xt(eps,t))
compute b=.80,a=.10
maximize logl 2 *
*
* Compute the estimates into the final two slots in fullbeta
*
compute fullbeta(4*n+1)=%beta(1),fullbeta(4*n+2)=%beta(2)
*
* Do one iteration of the full model with METHOD=BHHH to get
* the grand covariance matrix.
*
garch(p=1,q=1,mv=dcc,method=bhhh,initial=fullbeta,iters=50,hmatrices=hh) / x
set residual1 = eps(1)
set residual1sq = residual1 (t)*residual1 (t)
*** Checking standardised residuals ***
cor(qstats,number=12,span=4) residual1
*** Checking squared standardised residuals ***
cor(qstats,number=12,span=4) residual1sq
In addition, for the VAR EGARCH model. I used the codes as suggested:
Am I missing something, there is a(i)(1)=log(%seesq), but I did not do that for the dummy?
It converges with b a d g rr ad gd as well, but not when I add adtwo and gdtwo. Does that mean I just need to adjust adtwo and gdtwo to make it converge?
Thank you so much for time and help.
Eric
Last edited by Eric on Sun Aug 01, 2010 1:04 am, edited 3 times in total.
Re: VAR E-GARCH with dummies
Sorry. ustd is whatever you want to call your standardized residuals. The explicit range is determined by the %regstart() and %regend(), which matches the range on the SET with the range on the estimation instruction. SET, by default, tries to do the calculation over the full data range. When elements of the calculation are in SERIES[VECT] and SERIES[SYMM], if you do the calculation for an entry which never even had those defined, it can fail. So with those more complicated expressions, you need to let it know where it can actually do the calculations.Eric wrote:Dear Tom,
I think I am plotting the conditional correlation, could you please check if I am doing the right thing? In addition, I am unsure what you mean by specific range? In the last message you said:
set ustd %regstart() %regend() = ...
However, I do not have ustd and if what I should change is this line:
gset uu %regstart() %regend() = %outerxx(%xt(eps,t))
I am not sure how to set the range explicitly.
Virtually all of that is completely unnecessary if you're going to do:Eric wrote: Here is the code for the dcc garch:
<<DCC code>>
dec vect[series] eps(n)
dec vect fullbeta(4*n+2)
*
* Do univariate GARCH models. Save the standardized residuals
* into eps(i). Copy the coefficients into the proper slots in
* the full beta matrix.
*
do i=1,n
garch(p=1,q=1,resids=r,hseries=h) / x(i)
set eps(i) = r/sqrt(h)
do j=1,4
compute fullbeta(n*(j-1)+i)=%beta(j)
end do j
end do i
*
* Compute the covariance matrix of the standardized residuals
*
vcv(matrix=rr)
# eps
*
* Create the series[symm] uu (outer product of residuals). Make
* it the unconditional value prior to the sample.
*
dec series[symm] uu q
gset uu %regstart() %regend() = %outerxx(%xt(eps,t))
gset uu 1 %regstart()-1 = rr
gset q = rr
*
* Log likelihood for the DCC phase, taking the residuals as given
*
nonlin a b
dec frml[symm] qf
frml qf = (qx=(1-a-b)*rr+a*uu{1}+b*q{1})
frml logl = q=qf,%logdensity(%cvtocorr(q),%xt(eps,t))
compute b=.80,a=.10
maximize logl 2 *
*
* Compute the estimates into the final two slots in fullbeta
*
compute fullbeta(4*n+1)=%beta(1),fullbeta(4*n+2)=%beta(2)
*
* Do one iteration of the full model with METHOD=BHHH to get
* the grand covariance matrix.
*
<</DCC code>>
garch(p=1,q=1,mv=dcc,method=bhhh,initial=fullbeta,iters=50,hmatrices=hh) / x
If you're iterating the DCC model 50 times, doing the consistent but inefficient two step estimator isn't necessary, and really isn't necessary anyway unless you have many more than two series.
Get rid of the code indicated above and change your GARCH instruction toEric wrote: set residual1 = eps(1)
set residual1sq = residual1 (t)*residual1 (t)
*** Checking standardised residuals ***
cor(qstats,number=12,span=4) residual1
*** Checking squared standardised residuals ***
cor(qstats,number=12,span=4) residual1sq
Code: Select all
garch(p=1,q=1,mv=dcc,method=bhhh,iters=500,hmatrices=hh,rvector=u) / xthen you can do
Code: Select all
dec vect[series] eps(n)
do i=1,n
set eps(i) %regstart() %regend() = u(i)/sqrt(hh(t)(i,i))
end do iThe dummy coefficients (all of them) are shifts: the A coefficient that applies outside the dummied zone is A, while it's A+AD inside it. As such, zero's are probably reasonable guess values. If you wanted A outside and AD inside, you would have to write the calculation completely differently---you would have to do A*(1-dummy)+AD*dummy, and A*(1-dummy1-dummy2)+AD*dummy1+AD2*dummy2 for the two dummy case. Putting them in as shifts makes the whole thing easier to write and easier to interpret.Eric wrote: In addition, for the VAR EGARCH model. I used the codes as suggested:
Am I missing something, there is a(i)(1)=log(%seesq), but I did not do that for the dummy?
You might need to fuss a bit with the settings, possibly do some simplex iterations first. You might also find that it works better to add the adtwo and gdtwo first, fit that model, then add ad and gd for the third set of estimates.Eric wrote: It converges with b a d g rr ad gd as well, but not when I add adtwo and gdtwo. Does that mean I just need to adjust adtwo and gdtwo to make it converge?
Thank you so much for time and help. I really appreciate it!
Eric
Re: VAR E-GARCH with dummies
Dear Tom,
I am new to RATS and I am not sure if I get what you are suggesting.
Thanks again for the help.
Eric
I am new to RATS and I am not sure if I get what you are suggesting.
Thanks again for the help.
Eric
Last edited by Eric on Sun Aug 01, 2010 1:01 am, edited 3 times in total.
Re: VAR E-GARCH with dummies
This will do the DCC. The other model generally looks fine. Whether the diagnostics are acceptable is another issue. With 8000+ data points, it's very hard to get any model to pass diagnostics at the .05 level. What you have doesn't look bad at all; the 1st lag on both the level and square is on the order of .03-.04, and everything else is smaller than that.
Code: Select all
*
* Multivariate GARCH with two-step DCC estimator
*
*???? Do you really want this??? SMPL 1 5000
CAL(PPD=119,I)
OPEN DATA "F:\RATS\Barclaysdata.txt"
data(org=obs) / BarclaysUK BarclaysUS
*
compute n=2
dec vect[series] x(n)
compute i=0
set x(1) = BarclaysUK
set x(2) = BarclaysUS
garch(p=1,q=1,mv=dcc,method=bfgs,iters=500,hmatrices=hh,rvector=u) / x ;* THIS IS THE GARCH YOU SUGGESTED
;* WHERE SHOULD THIS GO?
* Right here-after the GARCH
dec vect[series] eps(n)
do i=1,n
set eps(i) %regstart() %regend() = u(i)/sqrt(hh(t)(i,i))
end do i
set residual1 = eps(1) ;* TESTING FOR AUTOCORRELATION
set residual1sq = residual1 (t)*residual1 (t)
*** Checking standardised residuals ***
cor(qstats,number=12,span=4) residual1
*** Checking squared standardised residuals ***
cor(qstats,number=12,span=4) residual1sq
set residual2 = eps(2)
set residual2sq = residual2 (t)*residual2 (t)
*** Checking standardised residuals ***
cor(qstats,number=12,span=4) residual2
*** Checking squared standardised residuals ***
cor(qstats,number=12,span=4) residual2sq
set rho12 = hh(t)(1,2)/sqrt(hh(t)(1,1)*hh(t)(2,2))
;* PLOT THE CC GRAPH, IS THIS CORRECT?
* Basically. Since there's no "RR", I took that off
graph(header="Dynamic Conditiional Correlation between BarUK with BarUS")
# rho12Re: VAR E-GARCH with dummies
Dear Tom,
How do I know that I am not getting a local maximum, but a global maximum in RATS when estimating the VAR EGARCH?
In addition, if I want to test whether the assumption of constant correlation of the VAR EGRACH model is valid, can I just do the Tse test on a GARCH on the same data or do I have to specifically do the test on the VAR EGARCH?
Thanks,
Eric
How do I know that I am not getting a local maximum, but a global maximum in RATS when estimating the VAR EGARCH?
In addition, if I want to test whether the assumption of constant correlation of the VAR EGRACH model is valid, can I just do the Tse test on a GARCH on the same data or do I have to specifically do the test on the VAR EGARCH?
Thanks,
Eric
Re: VAR E-GARCH with dummies
Unfortunately, if you have a model which is prone to having multiple modes, you really have no way to verify that you have the global maximum. You just need to try different starting values and see what happens.Eric wrote:Dear Tom,
How do I know that I am not getting a local maximum, but a global maximum in RATS when estimating the VAR EGARCH?
The Tse test will also work with the E-GARCH as the univariate model.Eric wrote:In addition, if I want to test whether the assumption of constant correlation of the VAR EGRACH model is valid, can I just do the Tse test on a GARCH on the same data or do I have to specifically do the test on the VAR EGARCH?
Re: VAR E-GARCH with dummies
Dear Tom,
Egarch does not appear to work for Tse's test, but tgarch does?
Thank you very much for your help.
Eric
Egarch does not appear to work for Tse's test, but tgarch does?
Thank you very much for your help.
Eric
Last edited by Eric on Tue Aug 10, 2010 2:21 pm, edited 1 time in total.