Learn R Programming

MSGARCH (version 0.17.7)

fit.bayes: Bayesian estimation.

Description

Method that performs Bayesian estimation of a MSGARCH_SPEC object on a set of observations.

Usage

fit.bayes(spec, y, ctr = list())

Arguments

spec
Model specification of class MSGARCH_SPEC created with create.spec.
y
Vector (of size T) of observations.
ctr
A list of control parameters. The control parameters have three components:
  • N.burn (integer >= 0): Number of discarded draws. (Default: N.burn = 5000)
  • N.mcmc (integer > 0) : Number of draws. (Default: N.mcmc = 10000)
  • N.thin (integer > 0) : Thinning factor (every N.thin draws are kept). (Default: N.thin = 10)
  • theta0 : Starting value for the chain (if empty the specification default value are used).
  • do.enhance.theta0 : Boolean indicating if the default parameters value are enhance using y variance. (Default: do.enhance.theta0 = FALSE)

Value

A list of class MSGARCH_BAY_FIT containing four components:
  • theta : The MCMC chain (matrix from the R package coda (Plummer et al., 2006) of size N.mcmc / N.thin).
  • accept : Acceptation rate of the sampler.
  • y : Vector (of size T) of observations.
  • spec : Model specification of class MSGARCH_SPEC created with create.spec.
The MSGARCH_BAY_FIT contains these methods:
  • AIC : Compute Akaike information criterion (AIC).
  • BIC : Compute Bayesian information criterion (BIC).
  • DIC : Compute Deviance Information Criterion (DIC).
  • ht : Conditional volatility in each regime.
  • kernel : Kernel method.
  • unc.vol : Unconditional volatility in each regime.
  • pred : Predictive method.
  • pit : Probability Integral Transform.
  • risk : Value-at-Risk And Expected-Shortfall methods.
  • simahead : Step ahead simulation method.
  • sim : Simulation method.
  • pdf : Probability density function.
  • cdf : Cumulative function.
  • Pstate : State probabilities filtering method.
  • summary : Summary of the fit.

Details

The total number of draws is equal to N.mcmc / N.thin. The Bayesian estimation uses the R package adaptMCMC (Andreas, 2012) which implements the adaptive sampler of Vihola (2012). The starting parameters are the specification default parameters. The argument do.enhance.theta0 uses the volatilities of rolling windows of y and adjust the default parameter of the specification so that the unconditional volatility of each regime is set to different quantiles of the volatilities of the rolling windows of y.

References

Andreas, S. (2012). adaptMCMC: Implementation of a Generic Adaptive Monte Carlo Markov Chain Sampler. https://cran.r-project.org/package=adaptMCMC.

Metropolis, N.; Rosenbluth, A. W.; Rosenbluth, M. N.; Teller, A. H. & Teller, E. (1953). Equation of State Calculations by Fast Computing Machines. Journal of Chemical Physics, 21, pp. 1087-1092.

Plummer, M. Best, N. Cowles, K. & Vines, K. (2006). CODA: Convergence Diagnosis and Output Analysis for MCMC. R News, 6, pp.7-11. https://cran.r-project.org/package=coda.

Vihola, M. (2012). Robust Adaptive Metropolis Algorithm with Coerced Acceptance Rate. Statistics and Computing, 22, pp. 997-1008.

Examples

Run this code
# load data
data("sp500")
sp500 = sp500[1:1000]

# create model specification
spec = MSGARCH::create.spec() 

# fit the model on the data with Bayesian estimation
set.seed(123)
fit = MSGARCH::fit.bayes(spec = spec, y = sp500, 
                         ctr = list(N.burn = 500, N.mcmc = 1000, N.thin = 1))
                         
summary(fit)

Run the code above in your browser using DataLab