Page 1 of 1

Conditional variance of SWARCH models

PostPosted: Thu Jul 05, 2012 6:12 am
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!

Re: Conditional variance of SWARCH models

PostPosted: Thu Jul 05, 2012 11:15 am
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)