cdf_stressed: Empirical Distribution Function of a Stressed Model

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/cdf_multivariate.R

Description

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

Usage

1
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").]

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.

Value

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

Author(s)

Kent Wu

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
     
## 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)

spesenti/SWIM documentation built on Jan. 15, 2022, 11:19 a.m.