Learn R Programming

SWIM (version 1.0.0)

mean_stressed: Mean of a Stressed Model

Description

Provides the mean of stressed model components (random variables) under the scenario weights.

Usage

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

Value

A matrix containing the means of the xCol components of the stressed model with weights wCol.

Details

mean_stressed: Sample mean of chosen stressed model components, subject to the calculated scenario weights.

See Also

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

Examples

Run this code
# NOT RUN {
     
## 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 mean
mean_stressed(res1, xCol = "all", wCol = "all", base = TRUE)

# }

Run the code above in your browser using DataLab