Learn R Programming

SWIM (version 1.0.0)

cdf_stressed: Empirical Distribution Function of a Stressed Model

Description

Provides the empirical distribution of a stressed model component (random variable) under the scenario weights

Usage

cdf_stressed(object, xCol = 1, wCol = "all", grid, base = FALSE)

Arguments

object

A SWIM or SWIMw object.

xCol

Numeric, (name of) the column of the underlying data of the object (default = 1).

wCol

Vector or characters, the columns of the scenario weights of the object (default = "all").

grid

Vector, the empirical distribution of the xCol component of the stressed model with weights wCol.

base

Logical, if TRUE, statistics under the baseline are also returned (default = "FALSE").]

Value

A matrix containing the empirical distribution function applied to grid of the xCol components of the stressed model with weights wCol.

Details

The cdf_stressed returns the values of the empirical distribution function of the xCol model components for weights wCol. In contrast, the cdf function returns a function, analogous to the ecdf from the base package. The function cdf_stressed is the cdf function applied to grid.

See Also

See cdf for the empirical distribution function of a stressed model component and quantile_stressed for sample quantiles of a stressed model.

Examples

Run this code
# NOT RUN {
     
## example with a stress on VaR
set.seed(0)
x <- as.data.frame(cbind(
  "normal" = rnorm(1000), 
  "gamma" = rgamma(1000, shape = 2)))
res1 <- stress(type = "VaR", x = x, 
  alpha = c(0.9, 0.95), q_ratio = 1.05)
grid <- seq(min(x$normal), max(x$normal), length.out = 5)
## stressed empirical distribution function
cdf_stressed(res1, xCol = 1, wCol = "all", grid = grid)

# }

Run the code above in your browser using DataLab