cor_stressed: Correlation of a Stressed Model

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

View source: R/cor.R

Description

Provides the correlation of stressed model components (random variable) under the scenario weights.

Usage

1
2
3
4
5
6
7
cor_stressed(
  object,
  xCol = c(1, 2),
  wCol = "all",
  method = "Pearson",
  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").

method

Character, one of "Pearson", "Spearman", "Kendall". (default = "Pearson").

base

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

Details

cor_stressed: The correlation coefficient of stressed model components, subject to the calculated scenario weights.

Value

cor_stressed returns a list of correlation matrices corresponding to different stresses. Entries of the matrices denote correlation coefficients between stressed model components specified by xCol.

Author(s)

Kent Wu

See Also

See var_stressed and sd_stressed compute stressed variance and standard deviations under the scenario weights, respectively.

See cor for unweighted correlations between model components, while cor_stressed return correlations between stressed model components

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
     
## 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 correlation
cor_stressed(res1, xCol = c(1, 2), wCol = 1, base=TRUE)

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