MSGARCH (version 2.3)

CreateSpec: Model specification.

Description

Creates a model specification before fitting and using the MSGARCH functionalities.

Usage

CreateSpec(variance.spec = list(model = c("sGARCH", "sGARCH")),
  distribution.spec = list(distribution = c("norm", "norm")),
  switch.spec = list(do.mix = FALSE, K = NULL), constraint.spec = list(fixed
  = list(), regime.const = NULL), prior = list(mean = list(), sd = list()))

Arguments

variance.spec

list with element model. model is a character vector (of size K, number of regimes) with the variance model specifications. Valid models are "sARCH", "sGARCH", "eGARCH", "gjrGARCH", and "tGARCH" (see *Details*). Default: model = c("sGARCH", "sGARCH").

distribution.spec

list with element distribution. distribution is a character vector (of size K) of conditional distributions. Valid distributions are "norm", "snorm", "std", "sstd", "ged", and "sged" (see *Details*). The vector must be of the same length as the models' vector in variance.spec. Default: distribution = c("norm", "norm").

switch.spec

list with element do.mix and K. do.mix is a logical indicating if the specification is a mixture type. If do.mix = TRUE, a Mixture of GARCH is created, while if do.mix = FALSE, a Markov-Switching GARCH is created (see *Details*). Default: do.mix = FALSE. K is a optional numeric scalar indicating the number of regime. In the case where a single regime is specified in variance.spec and distribution.spec, this parameter allows to automatically expand this single regime to K similar regimes without the need to explicitly define them in variance.spec and distribution.spec (see *Examples*).

constraint.spec

list with element fixed and regime.const. Only one of fixed and regime.const can be set by the user as it is not allowed to set both at the same time. fixed is a list with numeric entries and named elements. This argument controls for fixed parameters defined by the user. The names of the entries in the list have to coincide with the names of the model parameters. For instance, if contraint.spec = list(fixed = list(beta_1 = 0)), beta_1 will be fixed to 0 during optimization. regime.const is a character vector. This argument controls for the parameters which are set equal across regimes. The names of the entries in the list have to coincide with the names of the model parameters minus the regime indicator. For instance, if contraint.spec = list(regime.const = c("beta")), all the parameters named beta will be the same in all regimes during optimization.

prior

list with element mean and sd. The element mean and sd are list with numeric and named elements that allow to adjust the prior mean and standard deviation of the truncated Normal prior. The names of the entries in the lists have to coincide with the names of the model parameters. For instance, if prior = list(mean = list(beta_1 = 0.7), sd = list(beta_1 = 0.1)), the prior mean of beta_1 will be set to 0.7 while the prior standard deviation will set to 0.1.

Value

A list of class MSGARCH_SPEC with the following elements:

  • par0: Vector (of size d) of default parameters.

  • is.mix: Logical indicating if the specification is a mixture.

  • K: Number of regimes.

  • lower: Vector (of size d) of lower parameters' bounds.

  • upper: Vector (of size d) of upper parameters' bounds.

  • n.params: Vector (of size K) of the total number of parameters by regime including distributions' parameters.

  • n.params.vol: Vector (of size K) of the total number of parameters by regime excluding distributions' parameters.

  • label: Vector (of size d) of parameters' labels.

  • name: Vector (of size K) of model specifications' names.

  • func: List of internally used R functions.

  • rcpp.func: List of internally used Rcpp functions.

  • fixed.pars: List of user inputed fixed parameters.

  • regime.const.pars: Vector of user imputed parameter set equal across regimes.

  • regime.fixed.pars: Logical indicating if there is any fixed parameteter set by the user.

  • regime.const.pars.bool: Logical indicating if there is any parameteters equal across regime set by the user.

The MSGARCH_SPEC class has the following methods:

  • simulate: Simulation.

  • Volatility: In-sample conditional volatility.

  • predict: Forecast of the conditional volatility (and predictive distribution).

  • UncVol: Unconditional volatility.

  • PredPdf: Predictive density (pdf).

  • PIT: Probability Integral Transform.

  • Risk: Value-at-Risk and Expected-Shortfall.

  • State: State probabilities (smoothed, filtered, predictive, Viterbi).

  • FitML: Maximum Likelihood estimation.

  • FitMCMC: Bayesian estimation.

  • print and summary: Summary of the created specification.

Details

The Markov-Switching specification is based on the Haas et al. (2004a) MSGARCH specification. It is a MSGARCH model that is separated in K single-regime specifications which are updated in parallel. Under the Haas et al. (2004a) specification, the conditional variance is a function of past data and the current state. The Mixture of GARCH option (do.mix = TRUE) is based on Haas et al. (2004b). A Mixture of GARCH is a mixture of distributions where the variance process of each distribution is a single-regime process. For the models, "sARCH" is the ARCH(1) model (Engle, 1982), "sGARCH" the GARCH(1,1) model (Bollerslev, 1986), "eGARCH" the EGARCH(1,1) model (Nelson, 1991), "gjrGARCH" the GJR(1,1) model (Glosten et al., 1993), and "tGARCH" the TGARCH(1,1) model (Zakoian, 1994). For the distributions, "norm" is the Normal distribution, "std" the Student-t distribution, and "ged" the GED distribution. Their skewed version, implemented via the Fernandez and & Steel (1998) transformation, are "snorm", "sstd" and "sged". Please see Ardia et al. (2017) for more details on the models and distributions. The user must choose between fixed or regime.const in contraint.spec as both cannot be set at the same time. The list fixed.pars will ensure that the chosen fixed parameters will be fixed during optimization according to the values set by the user. Thus only the non-fixed parameters are optimized. The vector regime.const will ensure that the chosen parameters will be the same across regime during optimization. The list mean and sd in prior will adjust the prior mean and prior standard deviation of the truncated Normal prior for MCMC estimation via FitMCMC according to the inputed prior mean and standard deviation. Those prior means and standard deviations that are not set will take on preset default values (a mean of zero and a variance of 1,000).

References

Ardia, D. Bluteau, K. Boudt, K. Catania, L. & Trottier, D.-A. (2017). Markov-switching GARCH models in R: The MSGARCH package. https://ssrn.com/abstract=2845809

Engle, R. (1982). Autoregressive conditional heteroscedasticity with estimates of the variance of United Kingdom inflation Econometrica, 50, 987-1008.

Bollerslev, T. (1986). Generalized autoregressive conditional heteroskedasticity. Journal of Econometrics, 31, 307-327.

Fernandez, C. & Steel, M. F. (1998). On Bayesian modeling of fat tails and skewness. Journal of the American Statistical Association, 93, 359-371.

Glosten, L. R. Jagannathan, R. & Runkle, D. E. (1993). On the relation between the expected value and the volatility of the nominal excess return on stocks. Journal of Finance, 48, 1779-1801.

Haas, M. Mittnik, S. & Paolella, M. S. (2004a). A new approach to Markov-switching GARCH models. Journal of Financial Econometrics, 2, 493-530.

Haas, M. Mittnik, S. & Paolella, M. S. (2004b). Mixed normal conditional heteroskedasticity. Journal of Financial Econometrics, 2, 211-250.

Nelson, D. B. (1991). Conditional heteroskedasticity in asset returns: A new approach. Econometrica, 59, 347-370.

Zakoian, J.-M. (1994). Threshold heteroskedastic models. Journal of Economic Dynamics and Control, 18, 931-955.

Examples

Run this code
# NOT RUN {
# create a Markov-switching specification
# MS-GARCH(1,1)-GJR(1,1)-Student
spec <- CreateSpec(variance.spec = list(model = c("sGARCH","gjrGARCH")),
                   distribution.spec = list(distribution = c("std","std")),
                   switch.spec = list(do.mix = FALSE))
print(spec)

# create a 3-regime Markov-switching specification with the help of variable K
# MS(3)-GARCH(1,1)- Student
spec <- CreateSpec(variance.spec = list(model = c("sGARCH")),
                   distribution.spec = list(distribution = c("std")),
                   switch.spec = list(do.mix = FALSE, K = 3))
print(spec)

# create a mixture specification
# MIX-GARCH(1,1)-GJR(1,1)-Student
spec <- CreateSpec(variance.spec = list(model = c("sGARCH","gjrGARCH")),
                   distribution.spec = list(distribution = c("std","std")),
                   switch.spec = list(do.mix = TRUE))
print(spec)

# setting fixed parameter for the sGARCH beta parameter
# MS-GARCH(1,1)-GJR(1,1)-Student with beta_1 fixed to 0
spec <- CreateSpec(variance.spec = list(model = c("sGARCH","gjrGARCH")),
                   distribution.spec = list(distribution = c("std","std")),
                   switch.spec = list(do.mix = FALSE),
                   constraint.spec = list(fixed = list(beta_1 = 0)))
print(spec)

# setting restriction for the shape parameter of the Student-t across regimes
# MS-GARCH(1,1)-GJR(1,1)-Student with shape parameter constraint across regime
spec <- CreateSpec(variance.spec = list(model = c("sGARCH","gjrGARCH")),
                   distribution.spec = list(distribution = c("std","std")),
                   switch.spec = list(do.mix = FALSE),
                   constraint.spec = list(regime.const = c("nu")))
print(spec)

# setting custom parameter priors for the beta parameters
# MS-GARCH(1,1)-GJR(1,1)-Student with prior modification
spec <- CreateSpec(variance.spec = list(model = c("sGARCH","gjrGARCH")),
                   distribution.spec = list(distribution = c("std","std")),
                   switch.spec = list(do.mix = FALSE),
                   prior = list(mean = list(beta_1 = 0.9, beta_2 = 0.3),
                                sd = list(beta_1 = 0.05, beta_2 = 0.01)))
print(spec)
# }

Run the code above in your browser using DataCamp Workspace