Risk {MSGARCH}R Documentation

Value-at-Risk and Expected-shortfall.

Description

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

Usage

Risk(object, ...)

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

## S3 method for class 'MSGARCH_ML_FIT'
Risk(
  object,
  newdata = NULL,
  alpha = c(0.01, 0.05),
  do.es = TRUE,
  do.its = FALSE,
  nahead = 1L,
  do.cumulative = FALSE,
  ctr = list(),
  ...
)

## S3 method for class 'MSGARCH_MCMC_FIT'
Risk(
  object,
  newdata = NULL,
  alpha = c(0.01, 0.05),
  do.es = TRUE,
  do.its = FALSE,
  nahead = 1L,
  do.cumulative = FALSE,
  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 nmcmc 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))

nahead

Scalar indicating the number of step-ahead evaluation. (Default: nahead = 1L). Not used when do.its = TRUE as it only returns in-sample one-step ahead risk measures.

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).

do.cumulative

Logical indicating if the risk measures are computed on the cumulative simulations (typically log-returns, as they can be aggregated). Only available for do.its = FALSE. (Default: do.cumulative = FALSE)

ctr

A list of control parameters:

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

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

newdata

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

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 nsim paths up to t = T + T* + nahead. If do.its = FALSE, the risk estimators at t = T + T* + 1, ... ,t = T + T* + nahead are computed. do.cumulative = TRUE indicate the function to compute the risk meausre over aggregated period up to nahead period using the cumsum function on the simulated data.

Value

A list of class MSGARCH_RISK with the following elements:

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.

Examples

# create specification
spec <- CreateSpec()

# load data
data("SMI", package = "MSGARCH")

# risk from specification
par <- c(0.1, 0.1, 0.8, 0.2, 0.1, 0.8, 0.99, 0.01)
set.seed(1234)
risk <- Risk(object = spec, par = par, data = SMI, nahead = 5L)
head(risk)
plot(risk)

# risk from ML fit
fit <- FitML(spec = spec, data = SMI)
set.seed(1234)
risk <- Risk(object = fit, nahead = 5L)
head(risk)
plot(risk)

## Not run: 
# risk from MCMC fit
set.seed(1234)
fit <- FitMCMC(spec = spec, data = SMI)
risk <- Risk(object = fit, nahead = 5L)
head(risk)
plot(risk)

## End(Not run)

[Package MSGARCH version 2.51 Index]