Hamilton-Susmel JOE 1994 SWARCH model

Use this forum for posting example programs or short bits of sample code.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Hamilton-Susmel JOE 1994 SWARCH model

Unread post by TomDoan »

These are replication files for Hamilton and Susmel(1994), "Autoregressive Conditional Heteroskedasticity and Changes in Regime," Journal of Econometrics, vol 64, pp 307-333. This is a slightly different setup from the SWARCH.RPF example file. In this case, the variance is g(S(t))h(t) where h(t) is a common ARCH process in the standardized squared residuals eps(t-k)^2/g(S(t-k)). The difference between this and the SWARCH example is that in the SWARCH (in effect) the divisor in the standardization is g(S(t)) rather than g(S(t-k)). In the Hamilton-Susmel model, this makes the likelihood at t dependent upon current and lagged regimes as in the MS-VAR. The SWARCH.RPF example actually uses the model as described in Cai(1994), “A Markov Model of Switching-Regime ARCH,” Journal of Business and Economic Statistics, vol 12, no. 3, 309–316.

Two examples of Markov-Switching GARCH (rather than ARCH) models are provided at Dueker(1997) and Gray(1996). MS-ARCH and MS-GARCH models are one of the topics in the Structural Breaks and Switching Models e-course).
hs_garch.rpf
Standard ARCH/GARCH models
(1.15 KiB) Downloaded 1400 times
hs_swarch_gl22.rpf
Two regime-two lag model with Gaussian errors and asymmetry
(4.48 KiB) Downloaded 1186 times
hs_swarch_tl32.rpf
Three regime-two lag model with Student-t errors and asymmetry
(5.83 KiB) Downloaded 1160 times
crspw.txt
Data file
(18.2 KiB) Downloaded 1384 times
jack
Posts: 160
Joined: Tue Sep 27, 2016 11:44 am

Re: Hamilton-Susmel JOE 1994 SWARCH model

Unread post by jack »

Tom,
I run the hs_swarch_gl22.rpf model. Here is the results. As you can see one of the Markov switching parameters (TETHA (1,2)) is negative here? What does it mean?
And what's th interpretation of GV coefficients?
Can I use ARCHRegimeTF for estimation?
Mean of Dependent Variable       0.3318675188
Std Error of Dependent Variable  2.4924724398
Standard Error of Estimate       2.4397917647
Sum of Squared Residuals         7905.0313595
Regression F(1,1328)                  59.0119
Significance Level of F             0.0000000
Log Likelihood                     -3072.4314
Durbin-Watson Statistic                2.0018

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  Constant                     0.2631268919 0.0674959272      3.89841  0.00010166
2.  Y{1}                         0.2062651190 0.0268507225      7.68192  0.00000000


MAXIMIZE - Estimation by BFGS
Convergence in    16 Iterations. Final criterion was  0.0000058 <=  0.0000100

Weekly Data From 1962:07:24 To 1987:12:29
Usable Observations                      1328
Function Value                     -2838.3397

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  ALPHA                         0.328998535  0.049002870      6.71386  0.00000000
2.  BETA                          0.270396384  0.028910875      9.35276  0.00000000
3.  A(1)                         -0.002589909  0.024588624     -0.10533  0.91611430
4.  A(2)                          0.071632104  0.038582835      1.85658  0.06337099
5.  GV(1)                         1.313596960  0.128789850     10.19954  0.00000000
6.  GV(2)                         7.581986458  0.772274921      9.81773  0.00000000
7.  XI                            0.495972889  0.081255292      6.10388  0.00000000
8.  THETA(1,1)                    3.176104268  0.278115188     11.42010  0.00000000
9.  THETA(1,2)                   -2.866897602  0.312737734     -9.16710  0.00000000
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hamilton-Susmel JOE 1994 SWARCH model

Unread post by TomDoan »

From the comments:
*
* GV will be the relative variances in the regimes.
*
dec vect gv(nstates)
*
* The next is the vector of ARCH parameters, the asymmetry parameter and
* the degrees of freedom for the t errors. The constant in the ARCH
* equation is fixed at 1 as the normalization. (This differs from the
* normalization in the paper which normalizes one of the relative
* variances. The two are equivalent.)
*
dec vect a(q)
dec real xi
dec real nu
The GV's are the variance factors, so they aren't (and can't be) negative. The A's are the ARCH coefficients---basically there is no "ARCH" in your data, just different variance regimes.
jack
Posts: 160
Joined: Tue Sep 27, 2016 11:44 am

Re: Hamilton-Susmel JOE 1994 SWARCH model

Unread post by jack »

Thank you for your kind reply.
What about THETA (1,2)? What does it mean when it is negative?
And the results is based on a conditionally Gaussian distribution. Can I use t distribution (ARCHRegimeTF) for estimation here?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hamilton-Susmel JOE 1994 SWARCH model

Unread post by TomDoan »

The THETA's are for parameterizing the transition probabilities using logistic indexes. That's covered in the User's Guide and is used in the SWARCH.RPF example.

Yes, this is conditionally Gaussian and yes, you could use a t instead.
jack
Posts: 160
Joined: Tue Sep 27, 2016 11:44 am

Re: Hamilton-Susmel JOE 1994 SWARCH model

Unread post by jack »

Thanks a lot.
When I use ARCHRegimeTF for estimation I would get this error:

## SR10. Missing Values And/Or SMPL Options Leave No Usable Data Points

This is the final part of the program:

Code: Select all

compute a=%const(0.05),xi=0.0
set uu = %seesq
set u  = %resids
*
compute gstart=%regstart()+q,gend=%regend()
*
* We need to keep series of the residual (u) and squared residual (uu).
* Because the mean function is the same across regimes, we can just
* compute the residual and send it to ARCHRegimeGaussF, which computes the
* likelihoods for the different ARCH variances.
*
frml logl = u(t)=uf(t),uu(t)=u(t)^2,f=ARCHRegimeTF(t,u(t)),$
   fpt=%MSProb(t,f),log(fpt)
*
@MSFilterInit
maximize(parmset=meanparms+archparms+msparms,$
  start=%(p=%mslogisticp(theta),pstar=%MSInit()),$
 method=bfgs,iters=400,pmethod=simplex,piters=5) logl gstart gend
*
@MSSmoothed gstart gend psmooth
set p1 = psmooth(t)(1)
set p2 = psmooth(t)(2)
graph(max=1.0,footer="Probabilities of Regimes in Two Regime Gaussian model",$
  style=stacked) 2
# p1
# p2
I think I need to specify the degrees of freedom or nu.

In hs_swarch_tl32.rpf model you have assigned this value for it:
compute a=%const(0.05),d0=0.0,nu=10.0

has it been assigned arbitrarily? or it is based on the data? How I can assign a value for it?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hamilton-Susmel JOE 1994 SWARCH model

Unread post by TomDoan »

Those are guess values. NU=10 is somewhere in the middle. (NU can't be smaller than 2 and infinity is Normal).
jack
Posts: 160
Joined: Tue Sep 27, 2016 11:44 am

Re: Hamilton-Susmel JOE 1994 SWARCH model

Unread post by jack »

Dear Tom,

How can I compute and store the final variance of the model h(t)?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hamilton-Susmel JOE 1994 SWARCH model

Unread post by TomDoan »

This is a MS model. It doesn't generate a variance; it generates multiple regimes, each with its own variance and a probability on each. The end of the HS_SWARCH_TL32 program does a calculation of the predicted one-step variance which does probability weights of the different regimes.
jack
Posts: 160
Joined: Tue Sep 27, 2016 11:44 am

Re: Hamilton-Susmel JOE 1994 SWARCH model

Unread post by jack »

So, how can I check standardized residuals if there is any ARCH effects among them? How can I compute squared standardized residuals for LB Q statistic?
jack
Posts: 160
Joined: Tue Sep 27, 2016 11:44 am

Re: Hamilton-Susmel JOE 1994 SWARCH model

Unread post by jack »

In Gray's model thread for computing Squared Standardized Residuals from MS GARCH you suggested these commands:
set usqr gstart gend = uu(t)/h(t)
@regcorrs(title="Squared Standardized Residuals from MS GARCH",$
number=15,report) usqr

This can be applied to all of the MS GARCH models. (What you were computing is definitely not correct, since you're only taking the variance constant part of the GARCH recursion).
Is it applicable here for hs_swarch_tl32.rpf model too?
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hamilton-Susmel JOE 1994 SWARCH model

Unread post by TomDoan »

Since it's a common mean function

set stdu = u/sigmahat

will compute the standardized predictive residuals which you can use for diagnostics.
jack
Posts: 160
Joined: Tue Sep 27, 2016 11:44 am

Re: Hamilton-Susmel JOE 1994 SWARCH model

Unread post by jack »

I am really sorry :( . I couldn't find "sigma" or "sigmahat" in the hs_swarch_tl32.rpf program. :(
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Hamilton-Susmel JOE 1994 SWARCH model

Unread post by TomDoan »

It's at the 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)
jack
Posts: 160
Joined: Tue Sep 27, 2016 11:44 am

Re: Hamilton-Susmel JOE 1994 SWARCH model

Unread post by jack »

Dear Tom,

I have a gold returns time series. when I want to estimate a GARCH(1,1) model, I do my best but I really can't model the mean equation. It seems that there are many many AR or MA terms in the data. I'm somehow baffled about it.I would be grateful if you could possibly have a look at my data.
rr.xlsx
gold returns time series
(23.55 KiB) Downloaded 964 times
Post Reply