cdf {SWIM}R Documentation

Distribution Function of a Stressed Model

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

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

     
## 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)


[Package SWIM version 1.0.0 Index]