Learn R Programming

SWIM (version 1.0.0)

importance_rank: Importance Ranking for a Stressed Model

Description

Provides the importance ranks of the components (random variables) of a stressed model for different sensitivity measures.

Usage

importance_rank(
  object,
  xCol = "all",
  wCol = "all",
  type = c("Gamma", "Wasserstein", "reverse", "all"),
  f = NULL,
  k = NULL,
  s = NULL
)

Arguments

object

A SWIM or SWIMw object.

xCol

Numeric or character vector, (names of) the columns of the underlying data of the object (default = "all"). If xCol = NULL, only the transformed data f(x) is considered.

wCol

Vector, the columns of the scenario weights of the object corresponding to different stresses (default = "all").

type

Character, one of "Gamma", "Wasserstein", "Kolmogorov", "reverse", "all".

f

A function, or list of functions, that, applied to x, constitute the transformation of the data for which the sensitivity is calculated.

k

A vector or list of vectors, same length as f, indicating which columns of x each function in f operates on. When f is a list, k[[i]] corresponds to the input variables of f[[i]].

s

A function that, applied to x, defines the reverse sensitivity measure. If type = "reverse" and s = NULL, defaults to type = "Gamma".

Value

A data.frame containing the importance ranks of the stressed model for different sensitivity measures. Small values correspond to large sensitivities. Different rows correspond to different random variables. The first two rows specify the stress and type of the sensitivity measure on which the ranking is calculated.

Details

For the definition of the sensitivity measures (type), see sensitivity.

See Also

See sensitivity for the values of the sensitivity measures, plot_sensitivity for plotting sensitivity measures and summary for a summary statistic of a stressed model.

Examples

Run this code
# NOT RUN {
## example with a stress on VaR
set.seed(0)
x <- as.data.frame(cbind(
  "log-normal" = rlnorm(1000),
  "gamma" = rgamma(1000, shape = 2)))
res1 <- stress(type = "VaR", x = x,
  alpha = c(0.9, 0.95), q_ratio = 1.05)

importance_rank(res1, wCol = 1:2, type = "Gamma")
## sensitivity of log-transformed data
importance_rank(res1, wCol = 1, type = "all",
  f = list(function(x)log(x), function(x)log(x)), k = list(1, 2))

# }

Run the code above in your browser using DataLab