Learn R Programming

gnFit (version 0.2.0)

rskFac: Risk Factors

Description

The Value at Risk (VaR) of level \(\alpha\) (\(\alpha\)-quantile) of an event is a number attempting to summarize the risk of that event and define the worst expected loss of the event over a period of time. The Average VaR is another important measure of the risk at a given confidence level, which calculated by using the function of "rskFac".

Usage

rskFac(dat, alpha = 0.1, dist = "norm", df = NULL)

Arguments

dat

A numeric vector of object data.

alpha

Confidence level \(\alpha\) (\(0<\alpha<0.5\)).

dist

A named of distribution function which should be fitted to data values. The distibution function is selected by the name of "laplace", "logis", "gum", "t" and "norm".

df

degrees of freedom from a specified distribution function.

Value

The values of output are "VaR", "AVaR_n" and "AVaR_p" correspond to the VaR, Average VaR in left tail, Average VaR in right tail.

Details

Suppose \(X\) is random variable (rv) has distribution function (df) \(F\). Given a confidence level \(\alpha\in (0, 1),\) Value at Risk (VaR) of the underlying \(X\) at the confidence level \(\alpha\) is the smallest number \(x\) such that the probability that the underlying \(X\) exceeds \(x\) is at least \(1-\alpha.\) In other word, if \(X\) is a rv with symmetric distribution function \(F\) (e.g., the return value of a portfolio), then \(VaR_{\alpha}\) is the negative of the \(\alpha\) quantile, i.e., $$VaR_{\alpha}(X)=Q(\alpha)=inf{x \in Real : Pr( X \le x )\le \alpha}. $$ where, \(Q(.)=F^{-1}(.).\)

Since, the \(VaR_\alpha(X)\) is the nagative of \(\alpha\) quantile in the left tail, \(-VaR_{1-\alpha}(-X)\) is positive value of VaR in right tail.

The average \(VaR_\alpha,\) \((AVaR_\alpha)\) for \(0<\alpha\le 1\) of \(X\) is defined as $$ AVaR_\alpha(X)= \frac{1}{\alpha}\int_{0}^{\alpha}VaR(x) dx, $$ The AVaR is known under the names of conditional VaR (CVaR), tail VaR (TVaR) and expected shortfall.

Pflug and Romisch (2007, ISBN: 9812707409) shows the AVaR may be represented as the optimal value of the following optimization problem $$AVaR_\alpha (X) = VaR_\alpha(X) - \frac{1}{\alpha} E((X - VaR_\alpha(X))^{-}).$$ where, \((y)^{-} = min (y,0)\). To approximate the integral, it is given by $$AVaR_\alpha(X)=VaR_\alpha(X)+\frac{1}{t \alpha}\sum_{i=1}^{t}max{(VaR_\alpha(X) - X), 0},$$ where, \(t\) is number of observations. By considering the rv \(-X\), the \(-AVaR_{1-\alpha}\) in right tail is obtainable.

References

Pflug and Romisch (2007, ISBN: 9812707409)

Examples

Run this code
# NOT RUN {
library(rmutil)
r <- rlaplace(1000, m = 1, s = 2)
rskFac(r, dist = "laplace", alpha = 0.1)

# }

Run the code above in your browser using DataLab