stress_user {SWIM} | R Documentation |
User Defined Stress
Description
Returns a SWIM
object with scenario weights defined by the user.
Usage
stress_user(
x,
new_weights = NULL,
new_weightsfun = NULL,
k = 1,
names = NULL,
log = FALSE
)
Arguments
x |
A vector, matrix or data frame
containing realisations of random variables. Columns of |
new_weights |
A vector, matrix or data frame containing scenario
weights. Columns of |
new_weightsfun |
A list of functions, that applied to
the |
k |
Numeric, the column of |
names |
Character vector, the names of stressed models. |
log |
Boolean, the option to print weights' statistics. |
Value
A SWIM
object containing:
-
x
, a data.frame containing the data; -
new_weights
, a list, each component corresponds to a different stress and is either a vector of scenario weights (ifnew_weights
is provided) or (ifnew_weightsfun
is provided) a function, that applied to thek
th column ofx
, generates the vectors of scenario weights; -
type = "user"
; -
specs
, a list, each component corresponds to a different stress and containsk
.
See SWIM
for details.
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.
Csiszar I (1975). “I-divergence geometry of probability distributions and minimization problems.” The Annals of Probability, 146–158.
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_w()
,
stress_mean()
,
stress_moment()
,
stress_prob()
,
stress_wass()
,
stress()
Examples
set.seed(0)
x <- as.data.frame(cbind(
"normal" = rnorm(1000),
"gamma" = rgamma(1000, shape = 2)))
res1 <- stress(type = "user", x = x, new_weightsfun = function(x)x ^ 2, k = 1)
## plot user defined weights against the first column of x.
plot(x$normal, get_weights(res1), pch = ".")