Risk: Risk

View source: R/Risk.R

RiskR Documentation

Risk

Description

\loadmathjax

Risk measures such as Value at Risk (VaR) and Expected Shortfall (ES) with normal and t-student distributions based on variance-covariance method. It is a shortcut for VaR and ES.

Usage

Risk(
  variance,
  alpha = 0.95,
  measure = c("both", "VaR", "ES"),
  weights = NULL,
  model = c("both", "normal", "t-student"),
  df = NULL,
  percentage = FALSE
)

Arguments

variance

It could be either a scalar or a matrix containing the variances and covariances of the losses. Provide a covariance matrix when analyzing correlated losses or a scalar when dealing with a single loss.

alpha

The confidence level at which either the VaR or the ES will be computed, by default alpha is set to 0.95.

measure

An optional character string giving a measure for computing the risk. "VaR" stands for Value at Risk, "ES" stands for Expected Shortfall, and if both is chosen, then the function returns both the VaR and the ES as a result. By default measure is set to be "both".

weights

A vector containing the weights. It is only needed if variance is a matrix, if it is not then weights is set to 1.

model

A character string indicating which probability model has to be used for computing the risk measures, it could only be a normal distribution or a t-student distribution with \mjteqnvv degrees of freedom. The normal distribution is the default model for this function. model default value is set to 'both' to show normal and t-student VaR and ES. See example below.

df

An integer (df>2) denoting the degrees of freedom, only required if model='t-student'. Otherwise it has to be NULL.

percentage

Logical indicating whether the file names in the VaR table should be presented in percentage or decimal.

Value

A data.frame containing each risk measure at its corresponding confidence level.

Author(s)

Jilber Urbina

References

Dhaene J., Tsanakas A., Valdez E. and Vanduffel S. (2011). Optimal Capital Allocation Principles. The Journal of Risk and Insurance. Vol. 00, No. 0, 1-28.

Urbina, J. (2013) Quantifying Optimal Capital Allocation Principles based on Risk Measures. Master Thesis, Universitat Politècnica de Catalunya.

Urbina, J. and Guillén, M. (2014). An application of capital allocation principles to operational risk and the cost of fraud. Expert Systems with Applications. 41(16):7023-7031.

See Also

VaR, ES

Examples

# Reproducing Table 2.1 in page 47 of
# McNeal A., Frey R. and Embrechts P (2005).
alpha <- c(.90, .95, .975, .99, .995)
(Risk(variance=(0.2/sqrt(250))^2, alpha=alpha, measure='both', model='both', df=4))*10000

# only VaR results
(Risk(variance=(0.2/sqrt(250))^2, alpha=alpha, measure='VaR', model='both', df=4))*10000


# only SE based on a 4 degrees t-student.
(Risk(variance=(0.2/sqrt(250))^2, alpha=alpha, measure='ES', model='t-student', df=4))*10000

OCA documentation built on Feb. 16, 2023, 8:27 p.m.

Related to Risk in OCA...