Conditional variance of SWARCH models

Discussion of models with structural breaks or endogenous switching.
zy761
Posts: 13
Joined: Mon Mar 19, 2012 1:01 am

Conditional variance of SWARCH models

Unread post by zy761 »

I'm using the replication file of Hamilton and Susmel(1994): Autoregressive Conditional Heteroskedasticity and Changes in Regime to do the SWARCH model. I was able to obtain the result. This program gives us the residuals and squared residuals. However, I cannot find how to get the conditional variance in the ARCH equation. Can anyone help me how to get the conditional variance? Many thanks in advance!
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Conditional variance of SWARCH models

Unread post by TomDoan »

This calculates the one-step-ahead prediction for the variance and graphs it. (It works for either normal or t---the comments on this apply to putting it at the end of the HS_SWARCH_TL32.RPF program.)

Code: Select all

*
* Calculation of one-step-ahead predictions for the variance (bottom
* panel in figure 3). This weights the variance calculations in the
* branches by the predictions of the probabilities of the branches at t
* given t-1.
*
function OneStepVariance time
type real    OneStepVariance
type integer time
*
compute OneStepVariance=0.0
do i=1,nexpand
   compute h=1.0
   do k=1,q
      compute h=h+a(k)*uu(time-k)/gv(%MSLagState(i,k))
   end do k
   compute h=h+d0*%if(u(time-1)<0.0,uu(time-1)/gv(%MSLagState(i,1)),0.0)
   compute OneStepVariance=OneStepVariance+h*gv(%MSLagState(i,0))*pt_t1(time)(i)
end do i
end
*
set sigmahat gstart gend = sqrt(OneStepVariance(t))
set lower = -2.0*sigmahat
set upper = +2.0*sigmahat
*
spgraph(vfields=2,footer="Figure 3 (Top and Bottom Panels)")
graph(hlabel="Return")
# y
graph(hlabel="SWARCH-L(3,2)") 2
# upper
# lower / 1
spgraph(done)
zy761
Posts: 13
Joined: Mon Mar 19, 2012 1:01 am

Re: Conditional variance of SWARCH models

Unread post by zy761 »

Dear Tom,

Could you post another example of variance estimation for the Dueker's regime switching GARCH case? I have tried to duplicate and revise your above example to Dueker's code, but it does not seem to work. Appreciate your help a lot! Thanks.
Attachments
dueker_swgarch_nf.rpf
(5.53 KiB) Downloaded 1154 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Conditional variance of SWARCH models

Unread post by TomDoan »

That seems to be my program, not yours. It would be better if you showed me what you tried to do that didn't work. It involves taking the GARCHRegimeH function and, rather than returning a VECTOR of regime variances, returning the sum of regime variances weighted by pt_t1(time)(i).
zy761
Posts: 13
Joined: Mon Mar 19, 2012 1:01 am

Re: Conditional variance of SWARCH models

Unread post by zy761 »

Dear Tom,

Here is the code I wrote, but actually I am not sure how to deal with GARCHRegimeH(i). I added it at the end of the Dueker's program, and error message turns out that :

## SX15. Trying to Store into Constant or Expression. Called Parameter by Value?
>>>>e GARCHRegimeH(i)=1<<<<

Could you help me with this? Thanks!

Code: Select all

function OneStepVariance time
type real    OneStepVariance
type integer time
*
compute OneStepVariance=0.0
do i=1,nexpand
   compute GARCHRegimeH(i)=1.0+msg(2)*hs(%MSLagState(i,1))(time-1)+$
       msg(1)*uu(time-1)/gv(%MSLagState(i,1))+$
       %if(u(time-1)<0,msg(3)*uu(time-1)/gv(%MSLagState(i,1)),0.0)
   compute OneStepVariance=OneStepVariance+GARCHRegimeH(i)*gv(%MSLagState(i,1))*pt_t1(time)(i)
end do i
end

*
set sigmahat gstart gend = sqrt(OneStepVariance(t))
set lower = -2.0*sigmahat
set upper = +2.0*sigmahat
*
spgraph(vfields=2,footer="Figure 3 (Top and Bottom Panels)")
graph(hlabel="Return")
# y
graph(hlabel="SWARCH-L(3,2)") 2
# upper
# lower / 1
spgraph(done)
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Conditional variance of SWARCH models

Unread post by TomDoan »

As in the SWARCH case, you don't need to save each of the variances into a VECTOR when you're just doing the conditional variance. Add LOCAL REAL H, and replace GARCHRegimeH(i) with H.
zy761
Posts: 13
Joined: Mon Mar 19, 2012 1:01 am

Re: Conditional variance of SWARCH models

Unread post by zy761 »

Thanks Tom! It works.
Post Reply