Restricted MV-GARCH

Discussions of ARCH, GARCH, and related models

Restricted MV-GARCH

Postby FaeK » Tue Jun 26, 2012 12:02 pm

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)
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Restricted MV-GARCH

Postby TomDoan » Tue Jun 26, 2012 1:09 pm

This is an example for a CC-VARMAGARCH model done using MAXIMIZE. You can impose whatever restrictions you want on the coefficients.

agarch_max.rpf
Program file
(4.61 KiB) Downloaded 111 times

mhcdata.xls
data file
(265.03 KiB) Downloaded 85 times
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Restricted MV-GARCH

Postby FaeK » Wed Jun 27, 2012 6:59 am

Thanks very much cordially for your prompt reply and great help. It is perfectly working.
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Restricted MV-GARCH

Postby FaeK » Thu Jun 28, 2012 8:02 pm

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
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Restricted MV-GARCH

Postby TomDoan » Fri Jun 29, 2012 8:48 am

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.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Restricted MV-GARCH

Postby FaeK » Fri Jun 29, 2012 2:16 pm

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
Last edited by FaeK on Mon Jul 16, 2012 1:46 pm, edited 1 time in total.
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Restricted MV-GARCH

Postby moderator » Fri Jun 29, 2012 3:20 pm

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.
moderator
Site Admin
 
Posts: 306
Joined: Thu Oct 19, 2006 4:33 pm

Re: Restricted MV-GARCH

Postby FaeK » Sun Jul 01, 2012 5:57 pm

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.
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Restricted MV-GARCH

Postby moderator » Sun Jul 01, 2012 7:13 pm

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.
moderator
Site Admin
 
Posts: 306
Joined: Thu Oct 19, 2006 4:33 pm

Re: Restricted MV-GARCH

Postby FaeK » Tue Jul 03, 2012 5:33 am

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
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Restricted MV-GARCH

Postby FaeK » Mon Jul 09, 2012 6:41 am

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
Attachments
Code file.RPF
(2.68 KiB) Downloaded 67 times
Results file.pdf
(17.47 KiB) Downloaded 53 times
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Restricted MV-GARCH

Postby TomDoan » Mon Jul 09, 2012 4:25 pm

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 to 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)
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Restricted MV-GARCH

Postby FaeK » Wed Jul 11, 2012 3:25 pm

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
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Re: Restricted MV-GARCH

Postby TomDoan » Wed Jul 11, 2012 4:01 pm

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).
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Restricted MV-GARCH

Postby FaeK » Mon Jul 16, 2012 6:11 am

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
FaeK
 
Posts: 36
Joined: Tue Jan 03, 2012 9:01 pm

Next

Return to ARCH and GARCH Models

Who is online

Users browsing this forum: No registered users and 0 guests