Risk | R Documentation |
Method returning the Value-at-Risk and Expected-shortfall risk measures.
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(), ... )
object |
Model specification of class |
... |
Not used. Other arguments to |
par |
Vector (of size d) or matrix (of size |
data |
Vector (of size T) of observations. |
alpha |
Vector (of size R) of Value-at-risk and Expected-shortfall levels. |
nahead |
Scalar indicating the number of step-ahead evaluation. (Default: |
do.es |
Logical indicating if Expected-shortfall is also calculated.
(Default: |
do.its |
Logical indicating if the in-sample risk estimators are returned.
(Default: |
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 |
ctr |
A list of control parameters:
|
newdata |
Vector (of size T*) of new observations. (Default |
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.
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* + nahead
at the
chosen levels (matrix of size nahead
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* + nahead
at the
chosen levels (matrix of size nahead
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.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.