We describe the package MSGARCH, which implements Markov-switching GARCH (generalized autoregressive conditional heteroscedasticity) models in R with efficient C++ object-oriented programming. Markov-switching GARCH models have become popular methods to account for regime changes in the conditional variance dynamics of time series. The package MSGARCH allows the user to perform simulations as well as maximum likelihood and Bayesian Markov chain Monte Carlo estimations of a very large class of Markov-switching GARCH-type models. The package also provides methods to make single-step and multi-step ahead forecasts of the complete conditional density of the variable of interest. Risk management tools to estimate conditional volatility, value-at-risk, and expected-shortfall are also available. We illustrate the broad functionality of the MSGARCH package using exchange rate and stock market return data. ∼ D(0, 1, ξ k ).2 Furthermore, assuming a non zero state dependent mean would generally imply E[ytyt−1] = 0, which is against the model we specified.3 As explained below, the parametric formulation of the conditional distribution D(0, h k,t , ξ k ) can be different across regimes. In this case, the notation D k (0, h k,t , ξ k ) would be more appropriate. The same applies for the h(·) function in (2). We keep the simpler notation to improve readability. Also, for t = 1, we initialize the regime probabilities and the conditional variances at their unconditional levels. To simplify exposition, we use henceforth for t = 1 the same notation as for general t, since there is no confusion possible.
Conditional variance dynamicsAs in Haas et al. (2004a), the conditional variance of y t is assumed to follow a GARCHtype model. Hence, conditionally on regime s t = k, h k,t is available as a function of the past observation, y t−1 , past variance h k,t−1 , and the additional regime-dependent vector of parameters θ k :where h(·) is a I t−1 -measurable function that defines the filter for the conditional variance and also ensures its positiveness. In the MSGARCH package, the initial value of the variance recursions, that is h k,1 (k = 1, . . . , K), are set equal to the unconditional variance in regime k.Depending on the form of h(·), we obtain different scedastic specifications. In the R package MSGARCH, we follow this specification in order to reduce model complexity. Finally, when K = 1, we recover single-regime GARCH-type models identified by the form of h(·). 4 The mixture of GARCH model presented in Haas et al. (2004b) allows for interactions between the mixture component variances. Here, we report the case referred to as "Diagonal" by Haas et al. (2004b).
Journal of Statistical Software
5Below we briefly present the scedastic specifications available in the R package MSGARCH. Each of them is identified with a label used in the code for defining a model specification. Similarly, model coefficients are also identified with labels.
ARCH modelThe ARCH model of Engle (1982) is given by:for k = 1, . . . , K. In this case, we have θ...