Page 1 of 6
Gray JFE 1996 Markov Switching GARCH model
Posted: Sat May 25, 2013 1:22 pm
by TomDoan
Zip with programs and data replicates the analysis of weekly data from Gray(1996), "Modeling the conditional distribution of interest rates as a regime-switching process",
J. of Financial Economics, vol 42, pp 27-62. Because the variance at time t of a GARCH process is a recursive function of all data back to the start of the data set, calculation of the true log likelihood using a Hamilton filter isn't feasible. Instead, this approximates the log likelihood by collapsing the history. In practice, Gray's model seems too broad and the method of collapsing the history too imprecise to work successfully. It's extremely difficult to get the model to fit, and it's quite easy for the branches to describe ill-behaved GARCH processes.
Dueker's method uses a more tightly constrained collection of branches and also waits a half step longer before collapsing the historical information. The original
Hamilton-Susmel switching ARCH (rather than GARCH) model is also a good choice in many cases---while ARCH models have largely supplanted GARCH in standard situations, with the Markov switching component added, the Markov process can provide the greater level of dependence that requires use of GARCH in a non-switching situation.
The two filters for MS-GARCH models are covered in detail in the
2nd Edition of the Structural Breaks and Switching Models course.
Detailed description
Re: Gray JFE 1996 Markov Switching GARCH model
Posted: Tue Jan 03, 2017 3:29 am
by jack
Dear Tom,
I studied a similar paper about this subject entitle "Spot Market Volatility and Futures Trading: The Pitfalls of Using a Dummy Variable Approach In this paper Author try to model volatility shifts endogenously".
http://onlinelibrary.wiley.com/doi/10.1 ... 3/abstract
Is it possible to have a code for running their model in RATS?
I would be grateful if I you could possible guide me through this subject.
Re: Gray JFE 1996 Markov Switching GARCH model
Posted: Tue Jan 03, 2017 9:30 am
by TomDoan
Isn't this just an application of Gray's model?
Re: Gray JFE 1996 Markov Switching GARCH model
Posted: Tue Jan 03, 2017 9:39 am
by jack
I'm not sure. You mean that their model is just Gray's model? Are they the same? Can I replicate their result with Gray's model?
I'm sorry if I ask this question.
Re: Gray JFE 1996 Markov Switching GARCH model
Posted: Tue Jan 03, 2017 10:34 am
by TomDoan
I didn't read the paper in detail, but it sounds like that's what they did.
Re: Gray JFE 1996 Markov Switching GARCH model
Posted: Tue Jan 17, 2017 2:37 pm
by jack
Dear Tom,
I read their paper. It is based on Gray's paper and somehow Dueker's method.
I tried to replicate their model but I couldn't do it. I think it needs to write a new code for it, something that is far from my ability to do.
I would be grateful if you could possibly guide me through this problem ( I'm really sorry for asking this).
I contacted the authors but I din't get any reply from them.
Re: Gray JFE 1996 Markov Switching GARCH model
Posted: Wed Jan 18, 2017 9:40 am
by TomDoan
Gray and Dueker are most definitely not the same. You'd have to post what you tried.
Re: Gray JFE 1996 Markov Switching GARCH model
Posted: Wed Jan 18, 2017 1:25 pm
by jack
Their model is based on Gray" paper. But when they want to specify the GARCH part of the model, they say:

- image.png (53.32 KiB) Viewed 88304 times
I don"t know how to include this in the Gray' code and write a new code for running the model.
Re: Gray JFE 1996 Markov Switching GARCH model
Posted: Wed Jan 18, 2017 2:19 pm
by TomDoan
That's only a minor part of Dueker's paper---they're using the Gray approach, but using t errors (as Dueker did) rather than Normal (as Gray did).
My recommendation is that you just adopt Dueker's method entirely. Gray's is less accurate and more complicated.
Re: Gray JFE 1996 Markov Switching GARCH model
Posted: Wed Jan 18, 2017 2:40 pm
by jack
Thank you very much for your kind reply.
My goal is to investigate the introduction of futures contract on spot market volatility as those authors have done in their paper.
Those authors use ex ante and ex post probabilities for inferring about the timing of switches between the high- and low- volatility regimes and the for inferring about the effect of the introduction of futures contract on spot market volatility.
I don't know if Dueker' paper can be applied to this subject or not.
I again would be really grateful if you could possibly guide me.
Re: Gray JFE 1996 Markov Switching GARCH model
Posted: Wed Jan 18, 2017 3:12 pm
by TomDoan
Gray and Dueker are analyzing the same type of model (MS-GARCH). While there are some differences between how they choose to parameterize the model in their application (Gray allows the entire GARCH process to switch, Dueker following Hamilton and Susmel in allowing only a single variance inflation factor to change), the main difference is that each uses a different way of collapsing the lagged variances to avoid state-dependence. Dueker waits a 1/2 step longer, which makes it more accurate and (surprisingly) simpler.
The Dueker filter is covered in considerable detail as part of the
Structural Breaks and Switching Models e-course.
Re: Gray JFE 1996 Markov Switching GARCH model
Posted: Wed Jan 25, 2017 7:16 am
by jack
Dear Tom,
How can I compute the smoothed probabilities and the ex ante probabilities and the conditional standard deviation for Regime-switching GARCH in this code? In the code those have been done for Constant variance regime switching model. I appreciate your help very much.
Re: Gray JFE 1996 Markov Switching GARCH model
Posted: Wed Jan 25, 2017 9:45 am
by TomDoan
The smoothed and ex ante probabilities are computed using exactly the same three instructions as they are for the switching variance model.
@MSSmoothed %regstart() %regend() psmooth
set exante %regstart() %regend() = pt_t1(t)(1)
set smooth %regstart() %regend() = psmooth(t)(1)
The H series is the ex ante variance, so just take the square root of that for the standard deviation.
Re: Gray JFE 1996 Markov Switching GARCH model
Posted: Wed Jan 25, 2017 12:37 pm
by jack
Thank you very much for your help. I fixed it. But why conditional variance just mimics regime probabilities? In the Gray's paper it is said that "no longer do conditional variance estimates mimic regime probabilities".What's wrong with it?

- figure 5.png (20.5 KiB) Viewed 88224 times
Re: Gray JFE 1996 Markov Switching GARCH model
Posted: Wed Jan 25, 2017 2:48 pm
by TomDoan
It looks like you're graphing the original calculation. You need to do the calculations after the MAXIMIZE instructions for the MS-GARCH and you have to make sure you graph the square root of H, not the carryover standard deviation from the simpler model.