Restricted MV-GARCH
Restricted MV-GARCH
Dear Tom,
First of all, thanks very much for your great help with me. I am estimating a multivariate CC model of Bollerslev (1990) allowing for spillover effects in the variance equation [this model is from TSE book]. The code is posted below which is working perfectly fine. However, I need to restrict some ARCH parameters in the model to zero. So, I really need your help to do so.
equation xeq x
# constant x{1} y{1}
equation yeq y
# constant x{1} y{1}
group bimean xeq yeq
*
* The volatility model in (10.25) is almost what you would get by using the
* combination of MV=CC and VARIANCES=VARMA. The VARIANCES option specifies the
* formula used for computing the variances; VARMA is, in effect, a vector ARMA
* specification for those. The only difference between this and (9.22) is the 0
* restriction on the 1,2 element on the lagged squared residuals matrix.
*
garch(mv=cc,p=1,q=1, model=bimean,hmatrices=hd,rvector=rd,$
pmethod=simplex,variances=varma,piters=10,iters=200)
First of all, thanks very much for your great help with me. I am estimating a multivariate CC model of Bollerslev (1990) allowing for spillover effects in the variance equation [this model is from TSE book]. The code is posted below which is working perfectly fine. However, I need to restrict some ARCH parameters in the model to zero. So, I really need your help to do so.
equation xeq x
# constant x{1} y{1}
equation yeq y
# constant x{1} y{1}
group bimean xeq yeq
*
* The volatility model in (10.25) is almost what you would get by using the
* combination of MV=CC and VARIANCES=VARMA. The VARIANCES option specifies the
* formula used for computing the variances; VARMA is, in effect, a vector ARMA
* specification for those. The only difference between this and (9.22) is the 0
* restriction on the 1,2 element on the lagged squared residuals matrix.
*
garch(mv=cc,p=1,q=1, model=bimean,hmatrices=hd,rvector=rd,$
pmethod=simplex,variances=varma,piters=10,iters=200)
Re: Restricted MV-GARCH
This is an example for a CC-VARMAGARCH model done using MAXIMIZE. You can impose whatever restrictions you want on the coefficients.
Re: Restricted MV-GARCH
Dear Tom,
I tried to make the routine GARCH-in-mean and test for TSE test. Could you just check whether I have done it correctly. When estimating GARCH in mean based on the code below, it gave me zero values for the coefficients of the variances in the individual mean equation. I think I missed something, but I am not sure about it. I am so sorry, I just recently started learning to set codes in RATS.
*GARCH-in-mean
dec symm[series] hhs(2,2)
clear(zeros) hhs
nonlin(parmset=meanparms) b11 b12 b13 b14 b21 b22 b23 b24
frml resid(1) = (y(1)-b11-b12*y(1){1}-b13*hhs(1,1)-b14*hhs(2,2))
frml resid(2) = (y(2)-b21-b22*y(2){1}-b23*hhs(2,2)-b24*hhs(2,2))
*
linreg y(1) / u(1)
# constant y(1){1} hhs(1,1) hhs(2,2)
compute b11 = %beta(1),b12=%beta(2),b13=%beta(3),b14=%beta(4)
linreg y(2) / u(2)
# constant y(2){1} hhs(1,1) hhs(2,2)
compute b21 = %beta(1),b22=%beta(2),b23=%beta(3),b24=%beta(4)
*TSEtest
dec symm[series] xd(n-1,n-1)
dec symm qcinv(n,n)
ewise qcinv(i,j)=%if(i==j,1,qc(i-1,j))
compute qcinv=inv(qcinv)
*
* It makes sense to loop the calculations of the derivatives over time first, since much
* of the calculation depends only upon t.
*
dec vector ihu
do time=gstart+1,gend
compute ux=%xt(u,time),uux=uu(time-1),hx=h(time),ihu=%diag(%sqrt(%xdiag(hx)))*inv(hx)*ux
do i=1,n-1
do j=1,i
set xd(i,j) time time = -qcinv(i+1,j)*uux(i+1,j)+uux(i+1,j)*ihu(i+1)*ihu(j)
end do j
end do i
end do time
*
* The t-stat on the xd is the LM statistic
*
set ones gstart gend = 1.0
linreg ones
# ccderives xd
cdf(title='Tse Test chi-squared(1)') chisqr %trsq 1
Many thanks for valuable help again
Faek
I tried to make the routine GARCH-in-mean and test for TSE test. Could you just check whether I have done it correctly. When estimating GARCH in mean based on the code below, it gave me zero values for the coefficients of the variances in the individual mean equation. I think I missed something, but I am not sure about it. I am so sorry, I just recently started learning to set codes in RATS.
*GARCH-in-mean
dec symm[series] hhs(2,2)
clear(zeros) hhs
nonlin(parmset=meanparms) b11 b12 b13 b14 b21 b22 b23 b24
frml resid(1) = (y(1)-b11-b12*y(1){1}-b13*hhs(1,1)-b14*hhs(2,2))
frml resid(2) = (y(2)-b21-b22*y(2){1}-b23*hhs(2,2)-b24*hhs(2,2))
*
linreg y(1) / u(1)
# constant y(1){1} hhs(1,1) hhs(2,2)
compute b11 = %beta(1),b12=%beta(2),b13=%beta(3),b14=%beta(4)
linreg y(2) / u(2)
# constant y(2){1} hhs(1,1) hhs(2,2)
compute b21 = %beta(1),b22=%beta(2),b23=%beta(3),b24=%beta(4)
*TSEtest
dec symm[series] xd(n-1,n-1)
dec symm qcinv(n,n)
ewise qcinv(i,j)=%if(i==j,1,qc(i-1,j))
compute qcinv=inv(qcinv)
*
* It makes sense to loop the calculations of the derivatives over time first, since much
* of the calculation depends only upon t.
*
dec vector ihu
do time=gstart+1,gend
compute ux=%xt(u,time),uux=uu(time-1),hx=h(time),ihu=%diag(%sqrt(%xdiag(hx)))*inv(hx)*ux
do i=1,n-1
do j=1,i
set xd(i,j) time time = -qcinv(i+1,j)*uux(i+1,j)+uux(i+1,j)*ihu(i+1)*ihu(j)
end do j
end do i
end do time
*
* The t-stat on the xd is the LM statistic
*
set ones gstart gend = 1.0
linreg ones
# ccderives xd
cdf(title='Tse Test chi-squared(1)') chisqr %trsq 1
Many thanks for valuable help again
Faek
Re: Restricted MV-GARCH
I don't see anything that's even trying to estimate the GARCH model, so I can't help with that. You have to do the estimation first before you can do the LM test.
Re: Restricted MV-GARCH
Dear Tom,
I am sorry, I just posted the parts I modified in the previous post. I attached now the whole routine to the post which is working with me, but I am not sure whether I have done it correctly. Could you just tell me whether it is correct. what I am worried about, as I mentioned, is I get zero values for the parameters of the variances in the individual mean equations.
Thank you so much for all your help on my dissertation
Faek
I am sorry, I just posted the parts I modified in the previous post. I attached now the whole routine to the post which is working with me, but I am not sure whether I have done it correctly. Could you just tell me whether it is correct. what I am worried about, as I mentioned, is I get zero values for the parameters of the variances in the individual mean equations.
Thank you so much for all your help on my dissertation
Faek
Last edited by FaeK on Mon Jul 16, 2012 1:46 pm, edited 1 time in total.
Re: Restricted MV-GARCH
You're getting zeros for b13, b14, b23 and b24 in the MAXIMIZE? The LINREG will get zeros for those since the GARCH variances aren't defined when those are done. But it looks as if they should be fine for use in the later MAXIMIZE instruction.
Re: Restricted MV-GARCH
Dear Moderator,
Thank you very much for helping me with the code. I get the values of b13, b14 and b23, b24 in the MAXIMIZE, however, I get zeros for their standard errors.
Thank you very much for helping me with the code. I get the values of b13, b14 and b23, b24 in the MAXIMIZE, however, I get zeros for their standard errors.
Re: Restricted MV-GARCH
The HHS series aren't getting re-defined as part of the calculation. Change your logl to:
frml logl = $
hx = hf(t) , $
%pt(hhs,t,hx) , $
%do(i,1,n,u(i)=resid(i)) , $
ux = %xt(u,t), $
h(t)=hx, uu(t)=%outerxx(ux), $
%logdensity(hx,ux)
Since current HHS gets used in the RESID formulas, they have to be reset before the calculation of the residuals which is why they are up near the top after the calculation of the time t variances.
frml logl = $
hx = hf(t) , $
%pt(hhs,t,hx) , $
%do(i,1,n,u(i)=resid(i)) , $
ux = %xt(u,t), $
h(t)=hx, uu(t)=%outerxx(ux), $
%logdensity(hx,ux)
Since current HHS gets used in the RESID formulas, they have to be reset before the calculation of the residuals which is why they are up near the top after the calculation of the time t variances.
Re: Restricted MV-GARCH
Dear Moderator,
Thank you so much for your great help. It has worked now. The LINREG get zeros for those coefficients since, as you mentioned, the GARCH variances aren't defined when those are done. Shall I sort them out and there is a way around for that as well or just leave them as they are?
When I compared the results using GARCH function with this code using MAXIMIZE, they were relatively similar which means that there should not be a problem with them in the LINREG with zeros.
Thanks for Estima administration for the amazing help.
Faek
Thank you so much for your great help. It has worked now. The LINREG get zeros for those coefficients since, as you mentioned, the GARCH variances aren't defined when those are done. Shall I sort them out and there is a way around for that as well or just leave them as they are?
When I compared the results using GARCH function with this code using MAXIMIZE, they were relatively similar which means that there should not be a problem with them in the LINREG with zeros.
Thanks for Estima administration for the amazing help.
Faek
Re: Restricted MV-GARCH
Dear Tom,
I hope that you are well. I have incorporated GARCH-in-mean effects to Koutmos (1996) VAR-EGARCH model from Estima website. The code is working,however, the model finds difficulty to get converged in the final stages of maximization, even though the data points are multiplied by 100. The number of observations is around 3700. Although I tried different sample periods (less observation) and different data sets, the data still finds difficulty to get converged using such code. I also increased the number of iterations for both simplex and BFGS routines and made the estimation to skip the first few observations, I still got the same problem. I am not sure whether I miss any steps or need further steps in the code when incorporating GARCH-in-mean effects because without GARCH-in-mean effects the data gets converged. I will be highly grateful if you provide any advice. I have attached the code + results file (which shows the exact difficulty in the maximization).
Many thanks
Faek
I hope that you are well. I have incorporated GARCH-in-mean effects to Koutmos (1996) VAR-EGARCH model from Estima website. The code is working,however, the model finds difficulty to get converged in the final stages of maximization, even though the data points are multiplied by 100. The number of observations is around 3700. Although I tried different sample periods (less observation) and different data sets, the data still finds difficulty to get converged using such code. I also increased the number of iterations for both simplex and BFGS routines and made the estimation to skip the first few observations, I still got the same problem. I am not sure whether I miss any steps or need further steps in the code when incorporating GARCH-in-mean effects because without GARCH-in-mean effects the data gets converged. I will be highly grateful if you provide any advice. I have attached the code + results file (which shows the exact difficulty in the maximization).
Many thanks
Faek
- Attachments
-
- Code file.RPF
- (2.68 KiB) Downloaded 1149 times
-
- Results file.pdf
- (17.47 KiB) Downloaded 992 times
Re: Restricted MV-GARCH
The EGARCHSPILLOVER function isn't designed for a GARCH model with M effects, as it computes the covariance matrix and residuals at the same time, while you need the variances computed first since the residuals depend upon them. Take the calculation of the u's out of the EGARCHspillover function and insert them (easiest way is as a separate function) at the location indicated:
frml Lt = hh=EGARCHSpillover(t),%pt(hhs,t,hh),<<<calculate u(t)(i),i=1,...,n here>>>>,rd=%xt(u,t),%logdensity(hh,rd)
frml Lt = hh=EGARCHSpillover(t),%pt(hhs,t,hh),<<<calculate u(t)(i),i=1,...,n here>>>>,rd=%xt(u,t),%logdensity(hh,rd)
Re: Restricted MV-GARCH
Dear Tom,
Thank you very much for your help. I have taken the calculation of the u's out of the EGARCHspillover function and inserted them at the location you indicated as follows:
frml Lt = hh=EGARCHSpillover(t),%pt(hhs,t,hh), u(i)(t) = r(i)(t)-e(i)(t),i=1,n,rd=%xt(u,t),%logdensity(hh,rd)
The model has got converged, but I got zero standard errors for all coefficients of the second equation in the conditional mean. Do you think the calculation of u's is correct? I really appreciate your patience for asking such trivial questions.
Many thanks
Faek
Thank you very much for your help. I have taken the calculation of the u's out of the EGARCHspillover function and inserted them at the location you indicated as follows:
frml Lt = hh=EGARCHSpillover(t),%pt(hhs,t,hh), u(i)(t) = r(i)(t)-e(i)(t),i=1,n,rd=%xt(u,t),%logdensity(hh,rd)
The model has got converged, but I got zero standard errors for all coefficients of the second equation in the conditional mean. Do you think the calculation of u's is correct? I really appreciate your patience for asking such trivial questions.
Many thanks
Faek
Re: Restricted MV-GARCH
Write a FUNCTION to return the U. You can't simply write a loop inside a formula the way you're trying to do that. (As you guessed, it's just computing u for i=1).
Re: Restricted MV-GARCH
Dear Tom,
Thank you very much for all your help. Actually, I am not advanced user of RATS. I have been using it over last year. I did some progress but I am still learning how to write up functions or whatever. I have read the manual over last few days in the hope to do what you told in the post, but I failed to do so. I am not sure whether you can help me further,however, I personally do appreciate your great help,anyway.
Many thanks
Faek
Thank you very much for all your help. Actually, I am not advanced user of RATS. I have been using it over last year. I did some progress but I am still learning how to write up functions or whatever. I have read the manual over last few days in the hope to do what you told in the post, but I failed to do so. I am not sure whether you can help me further,however, I personally do appreciate your great help,anyway.
Many thanks
Faek
Re: Restricted MV-GARCH
function MyU time
type vector MyU
type integer time
*
dim MyU(n)
ewise MyU(i)=r(i)(time)-e(i)(time)
end
frml Lt = hh=EGARCHSpillover(t),%pt(hhs,t,hh),y=MyU(t),rd=%xt(u,t),%logdensity(hh,rd)
type vector MyU
type integer time
*
dim MyU(n)
ewise MyU(i)=r(i)(time)-e(i)(time)
end
frml Lt = hh=EGARCHSpillover(t),%pt(hhs,t,hh),y=MyU(t),rd=%xt(u,t),%logdensity(hh,rd)