stress_mean_w {SWIM} | R Documentation |
Stressing Mean
Description
Provides weights on simulated scenarios from a baseline stochastic model, such that a stressed model component (random variable) fulfils a constraint on its mean. Scenario weights are selected by constrained minimisation of the Wasserstein distance to the baseline model.
Usage
stress_mean_w(
x,
new_means,
k = 1,
h = 1,
names = NULL,
log = FALSE,
method = "Nelder-Mead",
...
)
Arguments
x |
A vector, matrix or data frame
containing realisations of random variables. Columns of |
new_means |
Numeric, the stressed mean. |
k |
Numeric, the column of |
h |
Numeric, a multiplier of the default bandwidth using Silverman’s rule (default |
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
|
Value
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 thek
th column ofx
, generates the vectors of scenario weights. Each component corresponds to a different stress; -
type = "mean"
; -
specs
, a list, each component corresponds to a different stress and containsk
andnew_means
.
See SWIM
for details.
Author(s)
Zhuomin Mao
References
Pesenti SM, Millossovich P, Tsanakas A (2019).
“Reverse sensitivity testing: What does it take to break the model?”
European Journal of Operational Research, 274(2), 654–670.
Pesenti S BAMPTA (2020).
“Scenario Weights for Importance Measurement (SWIM) - An R package for sensitivity analysis.”
Annals of Actuarial Science 15.2 (2021): 458-483. Available at SSRN: https://www.ssrn.com/abstract=3515274.
Pesenti SM (2021). “Reverse Sensitivity Analysis for Risk Modelling.” Available at SSRN 3878879.
See Also
Other stress functions:
stress_HARA_RM_w()
,
stress_RM_mean_sd_w()
,
stress_RM_w()
,
stress_VaR_ES()
,
stress_VaR()
,
stress_mean_sd_w()
,
stress_mean_sd()
,
stress_mean()
,
stress_moment()
,
stress_prob()
,
stress_user()
,
stress_wass()
,
stress()
Examples
## Not run:
set.seed(0)
x <- as.data.frame(cbind(
"normal" = rnorm(1000),
"gamma" = rgamma(1000, shape = 2)))
res1 <- stress_wass(type = "mean", x = x, k = 1,
new_means=1)
summary(res1)
## calling stress_RM_w directly
## stressing "gamma"
res2 <- stress_mean_w(x = x,
new_means=2.2, k = 2)
summary(res2)
## End(Not run)