Provides weights on simulated scenarios from a baseline stochastic
model, such that a stressed model component (random variable) fulfills a
constraint on its HARA utility defined by a, b and
eta parameter and risk measure defined by a gamma
function and evaluated at a given level alpha. Scenario weights are
selected by constrained minimisation of the Wasserstein distance to the
baseline model.
stress_HARA_RM_w(
x,
alpha = 0.8,
a,
b,
eta,
q_ratio = NULL,
q = NULL,
hu_ratio = NULL,
hu = NULL,
k = 1,
h = 1,
gamma = NULL,
names = NULL,
log = FALSE,
method = "Nelder-Mead"
)A vector, matrix or data frame
containing realisations of random variables. Columns of x
correspond to random variables; OR
A SWIMw object, where x corresponds to the
underlying data of the SWIMw object. The stressed random component is assumed continuously distributed.
Numeric, vector, the level of the Expected Shortfall. (default Expected Shortfall)
Numeric vector, input to HARA utility function.
Numeric vector, input to HARA utility function.
Numeric vector, input to HARA utility function.
Numeric, vector, the ratio of the stressed RM to
the baseline RM (must be same length as alpha).
Numeric, vector, the stressed RM at level
alpha (must be same length as alpha).
Numeric, vector, the ratio of the HARA utility to the baseline HARA utility.
Numeric, vector, the stressed HARA utility with parameters
a, b and eta.
Numeric, the column of x that is stressed
(default = 1).
Numeric, a multiplier of the default bandwidth using Silverman<U+2019>s rule (default h = 1).
Function of one variable, that defined the gamma of the risk measure. (default Expected Shortfall).
Character vector, the names of stressed models.
Boolean, the option to print weights' statistics.
The method to be used in [stats::optim()]. (default = Nelder-Mead).
A SWIMw object containing:
x, a data.frame containing the data;
h, h is a multiple of the Silverman<U+2019>s rule;
u, vector containing the gridspace on [0, 1];
lam, vector containing the lambda's of the optimized model;
str_fY, function defining the densities of the stressed component;
str_FY, function defining the distribution of the stressed component;
str_FY_inv, function defining the quantiles of the stressed component;
gamma, function defining the risk measure;
new_weights, a list of functions, that applied to
the kth column of x, generates the vectors of scenario
weights. Each component corresponds to a different stress;
type = "HARA RM";
specs, a list, each component corresponds to
a different stress and contains k, alpha, a, b,
eta, q, and hu.
See SWIM for details.
This function implements stresses on distortion risk measures.
Distortion risk measures are defined by a square-integrable function
gamma where
$$\int_0^1 gamma(u) du = 1.$$
The distortion risk measure for some gamma and distribution
G is calculated as:
$$\rho_{gamma}(G) = \int_0^1 \breve(G)(u) gamma(u) du.$$
Expected Shortfall (ES) is an example of a distortion risk measure.
The ES at level alpha of a random variable with distribution
function F is defined by:
$$ES_{alpha} = 1 / (1 - alpha) * \int_{alpha}^1 VaR_u d u.$$
The HARA Utility is defined by $$u(x) = \frac{1-eta}{eta}(\frac{ax}{1 - eta} + b)^eta$$.
Pesenti2019reverseSWIM
Pesenti2020SSRNSWIM
Pesenti2021SSRNSWIM
Other stress functions:
stress_RM_mean_sd_w(),
stress_RM_w(),
stress_VaR_ES(),
stress_VaR(),
stress_mean_sd_w(),
stress_mean_sd(),
stress_mean_w(),
stress_mean(),
stress_moment(),
stress_prob(),
stress_user(),
stress_wass(),
stress()
# NOT RUN {
set.seed(0)
x <- as.data.frame(cbind(
"normal" = rnorm(1000),
"gamma" = rgamma(1000, shape = 2)))
res1 <- stress_wass(type = "HARA RM", x = x, a=1, b=5, eta=0.5, alpha=0.95,
q_ratio=1.05, hu_ratio=1.05, k=1)
summary(res1)
## calling stress_RM_w directly
## stressing "gamma"
res2 <- stress_HARA_RM_w(x = x, a=1, b=5, eta=0.5, alpha=0.95,
q_ratio=1.05, hu_ratio=1.05, k=2)
summary(res2)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab