ES_stressed {SWIM} | R Documentation |
Value-at-Risk and Expected Shortfall of a Stressed Model
Description
Provides the Value-at-Risk (VaR) and the Expected Shortfall (ES) for components (random variables) of a stochastic model.
Usage
ES_stressed(
object,
alpha = 0.95,
xCol = "all",
wCol = 1,
base = FALSE,
gamma = NULL
)
VaR_stressed(object, alpha = 0.95, xCol = "all", wCol = 1, base = FALSE)
Arguments
object |
A |
alpha |
Numeric vector, the levels of the stressed VaR and ES
( |
xCol |
Numeric or character vector, (names of) the columns of
the underlying data
of the |
wCol |
Numeric, the column of the scenario weights
of the |
base |
Logical, if |
gamma |
Function that defines the gamma of the risk measure. If null,
the Expected Shortfall (ES) will be used. |
Details
ES_stressed
: The ES of a stressed model is the
ES of a chosen stressed model component, subject to the calculated scenario
weights. The ES at level alpha
of a stressed model
component is given by:
ES_{alpha} = 1 / (1 - alpha) * \int_{alpha}^1 VaR_u^W d u,
where VaR_u^W
is the VaR of the stressed model component, defined below.
VaR_stressed
: The VaR of a model is the VaR (quantile) of
a chosen stressed model component, subject to the calculated scenario weights.
The VaR at level alpha
of a stressed model component with
stressed distribution function F^W is defined as its
left-quantile at alpha:
VaR_{alpha}^W = F^{W,-1}(alpha).
The function VaR_stressed
provides the empirical quantile, whereas
the function quantile_stressed
calculates quantiles of model
components with different interpolations.
Value
ES_stressed
: Returns a matrix with the empirical or KDE
ES's at level alpha
of
model components specified in xCol
, under the scenario weights
wCol
.
VaR_stressed
: Returns a matrix with the empirical or KDE VaR's
at level alpha
of
model components specified in xCol
, under the scenario weights
wCol
.
Functions
-
ES_stressed
: Expected Shortfall of a stressed model -
VaR_stressed
: Value-at-Risk of a stressed model.
Author(s)
Silvana M. Pesenti, Zhuomin Mao
See Also
See quantile_stressed
for quantiles other than the
empirical quantiles and cdf
for the empirical or KDE distribution
function of a stressed model.
Examples
## example with a stress on VaR
set.seed(0)
x <- as.data.frame(cbind(
"normal" = rnorm(1000),
"gamma" = rgamma(1000, shape = 2)))
res1 <- stress(type = "VaR", x = x,
alpha = c(0.9, 0.95), q_ratio = 1.05)
## stressed ES
quantile_stressed(res1, probs = seq(0.9, 0.99, 0.01),
xCol = 1, wCol = 2, type = "i/n")
quantile(x[, 1], probs = seq(0.9, 0.99, 0.01), type = 1)
VaR_stressed(res1, alpha = seq(0.9, 0.99, 0.01), xCol = 1,
wCol = 2, base = TRUE)
## the ES of both model components under stress one
ES_stressed(res1, alpha = seq(0.9, 0.99, 0.01), xCol = "all",
wCol = 1)
## the ES of both model components under stress two
ES_stressed(res1, alpha = seq(0.9, 0.99, 0.01), xCol = "all",
wCol = 2)