Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/stress_RM_mean_std.R
Provides weights on simulated scenarios from a baseline stochastic
model, such that a stressed model component (random variable) fulfils a
constraint on its mean, standard deviation, 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
x |
A vector, matrix or data frame
containing realisations of random variables. Columns of |
alpha |
Numeric, vector, the level of the Expected Shortfall. ( |
new_means |
Numeric, the stressed mean. |
new_sd |
Numeric, the stressed standard deviation. |
q_ratio |
Numeric, vector, the ratio of the stressed RM to
the baseline RM (must be same length as |
q |
Numeric, vector, the stressed RM at level
|
k |
Numeric, the column of |
h |
Numeric, a multiplier of the default bandwidth using Silverman’s rule (default |
gamma |
Function of one variable, that defined the gamma of the risk measure. ( |
names |
Character vector, the names of stressed models. |
log |
Boolean, the option to print weights' statistics. |
method |
The method to be used in [stats::optim()]. ( |
... |
Additional arguments to be passed to
|
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:
ρ_{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.
A SWIMw
object containing:
x
, a data.frame containing the data;
h
, h is a multiple of the Silverman’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 k
th column of x
, generates the vectors of scenario
weights. Each component corresponds to a different stress;
type = "RM mean sd"
;
specs
, a list, each component corresponds to
a different stress and contains k
, alpha
,
q
, new_means
, and new_sd
.
See SWIM
for details.
Zhuomin Mao
Pesenti2019reverseSWIM
Pesenti2020SSRNSWIM
Pesenti2021SSRNSWIM
Other stress functions:
stress_HARA_RM_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()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ## Not run:
set.seed(0)
x <- as.data.frame(cbind(
"normal" = rnorm(1000),
"gamma" = rgamma(1000, shape = 2)))
res1 <- stress_wass(type = "RM mean sd", x = x,
alpha = 0.9, q_ratio = 1.05, new_means=1, new_sd=0.9)
summary(res1)
## calling stress_RM_w directly
## stressing "gamma"
res2 <- stress_RM_mean_sd_w(x = x, alpha = 0.9,
q_ratio = 1.05, new_means=2.2, new_sd=1.5, k = 2)
summary(res2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.