Learn R Programming

MSGARCH (version 1.3)

Risk: Value-at-Risk and Expected-shortfall.

Description

Method returning the Value-at-Risk and Expected-shortfall risk measures.

Usage

Risk(object, ...)

# S3 method for MSGARCH_SPEC Risk(object, par, data, alpha = c(0.01, 0.05), do.es = TRUE, do.its = FALSE, n.ahead = 1L, ctr = list(), ...)

# S3 method for MSGARCH_ML_FIT Risk(object, new.data = NULL, alpha = c(0.01, 0.05), do.es = TRUE, do.its = FALSE, n.ahead = 1L, ctr = list(), ...)

# S3 method for MSGARCH_MCMC_FIT Risk(object, new.data = NULL, alpha = c(0.01, 0.05), do.es = TRUE, do.its = FALSE, n.ahead = 1L, ctr = list(), ...)

Arguments

object

Model specification of class MSGARCH_SPEC created with CreateSpec or fit object of type MSGARCH_ML_FIT created with FitML or MSGARCH_MCMC_FIT created with FitMCMC.

...

Not used. Other arguments to Risk.

par

Vector (of size d) or matrix (of size n.mcmc x d) of parameter estimates where d must have the same length as the default parameters of the specification.

data

Vector (of size T) of observations.

alpha

Vector (of size R) of Value-at-risk and Expected-shortfall levels. (Default: alpha = c(0.01, 0.05))

do.es

Logical indicating if Expected-shortfall is also calculated. (Default: do.es = TRUE)

do.its

Logical indicating if the in-sample risk estimators are returned. (Default: do.its = FALSE)

n.ahead

Scalar indicating the number of step-ahead evaluation. (Default: n.ahead = 1L)

ctr

A list of control parameters:

  • n.mesh (integer >= 0) : Number of points for density evaluation. (Default: n.mesh = 1000L)

  • n.sim (integer >= 0) : Number indicating the number of simulation done for estimation of the density at n.ahead > 1. (Default: n.sim = 10000L)

new.data

Vector (of size T*) of new observations. (Default new.data = NULL)

Value

A list of class MSGARCH_RISK with the following elements:

  • VaR: If do.its = FALSE: Value-at-Risk at t = T + T* + 1, ... ,t = T + T* + n.ahead at the chosen levels (matrix of size n.ahead x R). If do.its = TRUE: In-sample Value-at-Risk at the chosen levels (Matrix of size (T + T*) x R).

  • ES: If do.its = FALSE: Expected-shortfall at t = T + T* + 1, ... ,t = T + T* + n.ahead at the chosen levels (matrix of size n.ahead x R). If do.its = TRUE: In-sample Expected-shortfall at the chosen levels (Matrix of size (T + T*) x R).

The MSGARCH_RISK contains the plot method. Note that the MCMC/Bayesian risk estimator can take long time to calculate depending on the size of the MCMC chain.

Details

If a matrix of MCMC posterior draws is given, the Bayesian Value-at-Risk and Expected-shortfall are calculated. Two or more step ahead risk measures are estimated via simulation of n.sim paths up to t = T + T* + n.ahead. If do.its = FALSE, the risk estimators at t = T + T* + 1, ... ,t = T + T* + n.ahead are computed.

Examples

Run this code
# NOT RUN {
# load data
data("SMI", package = "MSGARCH")

# create model specification
# MS(2)-GARCH(1,1)-Normal (default)
spec <- CreateSpec()

# fit the model on the data with ML estimation
fit <- FitML(spec = spec, data = SMI)

# compute the Value-at-Risk and Expected-shortfall in-sample
risk.its <- Risk(object = fit, alpha = 0.05, do.es = FALSE, do.its = TRUE)
plot(risk.its)

# compute the one-step ahead Value-at-Risk and Expected-shortfall out-of-sample
Risk(object = fit, alpha = 0.05, do.es = FALSE, do.its = FALSE, n.ahead = 1L)
# }

Run the code above in your browser using DataLab