sd_stressed: Standard Deviation and Variance of a Stressed Model

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

View source: R/sd.R

Description

Provides the standard deviation and variance of stressed model components (random variables) under the scenario weights.

Usage

1
2
3
sd_stressed(object, xCol = "all", wCol = "all", base = FALSE)

var_stressed(object, xCol = "all", wCol = "all", base = FALSE)

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

wCol

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

base

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

Details

sd_stressed: The standard deviation of a chosen model component, subject to the calculated scenario weights.

var_stressed: The variance of a chosen stressed model component, subject to the calculated scenario weights.

Value

sd_stressed: Return the standard deviation of the xCol component of the stressed model with weights wCol. The quantity can be evaluated at a vector.

var_stressed: Return the variance of the xCol component of the stressed model with weights wCol. The quantity can be evaluated at a vector.

Functions

Author(s)

Kent Wu

See Also

See mean_stressed for means of stressed model components, and cor_stressed for correlations between stressed model components.

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)
## stressed standard deviation
sd_stressed(res1, xCol = "all", wCol = "all", base = TRUE)

## stressed variance
var_stressed(res1, xCol = "all", wCol = "all", base = TRUE)

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