cdf: Distribution Function of a Stressed Model

Description Usage Arguments Value Author(s) See Also Examples

View source: R/cdf.R

Description

Provides the empirical distribution function of a stressed SWIM model component (random variable) or KDE distribution of a stressed SWIMw model component under the scenario weights.

Usage

1
cdf(object, xCol = 1, wCol = 1)

Arguments

object

A SWIM or SWIMw object.

xCol

Numeric or character, (name of) the columns of the underlying data of the object (default = 1).

wCol

Numeric, the columns of the scenario weights of the object (default = 1).

Value

The empirical or KDE distribution function (a function) of the xCol component of the stressed model with weights wCol. The empirical distribution function can be evaluated at a vector.

Author(s)

Silvana M. Pesenti, Zhuomin Mao

See Also

See plot_cdf for plotting the empirical or KDE distribution function of the stressed model and quantile_stressed for sample quantiles of a stressed model.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
     
## 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(res1, xCol = 1, wCol = 1)(grid)
## baseline empirical distribution function
ecdf(x$normal)(grid)

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