stress_prob: Stressing Intervals

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

View source: R/stress_prob.R

Description

Provides weights on simulated scenarios from a baseline stochastic model, such that a stressed model component (random variable) fulfils constraints on probability of disjoint intervals. Scenario weights are selected by constrained minimisation of the relative entropy to the baseline model.

Usage

1
stress_prob(x, prob, lower = NULL, upper, k = 1, names = NULL, log = FALSE)

Arguments

x

A vector, matrix or data frame containing realisations of random variables. Columns of x correspond to random variables; OR
A SWIM object, where x corresponds to the underlying data of the SWIM object.

prob

Numeric vector, stressed probabilities corresponding to the intervals defined through lower and upper.

lower

Numeric vector, left endpoints of the intervals.

upper

Numeric vector, right endpoints of the intervals.

k

Numeric, the column of x that is stressed (default = 1).

names

Character vector, the names of stressed models.

log

Boolean, the option to print weights' statistics.

Details

The intervals are treated as half open intervals, that is the lower endpoint are not included, whereas the upper endpoint are included. If upper = NULL, the intervals are consecutive and prob cumulative.
The intervals defined through lower and upper must be disjoint.

Value

A SWIM object containing:

See SWIM for details.

Author(s)

Silvana M. Pesenti

References

\insertRef

Pesenti2019reverseSWIM

\insertRef

Pesenti2020SSRNSWIM

\insertRef

Csiszar1975SWIM

See Also

Other stress functions: stress_HARA_RM_w(), stress_RM_mean_sd_w(), stress_RM_w(), stress_VaR_ES(), stress_VaR(), stress_mean_sd_w(), stress_mean_sd(), stress_mean_w(), stress_mean(), stress_moment(), stress_user(), stress_wass(), stress()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
set.seed(0)
x <- rnorm(1000)
## consecutive intervals
res1 <- stress(type = "prob", x = x, prob = 0.008, upper = -2.4)
# probability under the stressed model
cdf(res1, xCol = 1)(-2.4)

## calling stress_prob directly
## multiple intervals
res2 <- stress_prob(x = x, prob = c(0.008, 0.06), 
  lower = c(-3, -2), upper = c(-2.4, -1.6))
# probability under the stressed model
cdf(res2, xCol = 1)(c(-2.4, -1.6)) - cdf(res2, xCol = 1)(c(-3, -2))

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