qrmtools (version 0.0-6)

risk_measures: Risk Measures

Description

Computing risk measures for various distributions.

Usage

VaR_t(alpha, mu=0, sigma=1, df=Inf)
ES_t(alpha, mu=0, sigma=1, df=Inf)
VaR_Par(alpha, theta)
ES_Par(alpha, theta)

Arguments

alpha

confidence level (in [0,1]).

mu

location parameter.

sigma

scale parameter, a positive number.

df

degrees of freedom, a positive number; choose df=Inf for the normal distribution.

theta

Pareto parameter, a positive number.

Value

VaR_t(), ES_t() compute Value-at-Risk and expected shortfall for the \(t\) (or normal) distribution.

VaR_Par(), ES_Par() compute Value-at-Risk and expected shortfall for the Pareto distribution.

Details

The distribution function of the (standard) Pareto distribution is given by $$F(x)=1-(1+x)^{-\theta},\ x\ge 0,$$ where \(\theta>0\).

References

McNeil, A. J., Frey, R., and Embrechts, P. (2015). Quantitative Risk Management: Concepts, Techniques, Tools. Princeton University Press.

Examples

Run this code
## Example 2.16 in McNeil, Frey, Embrechts (2015)
V <- 10000 # value of the portfolio today
sig <- 0.2/sqrt(250) # daily volatility (annualized volatility of 20%)
nu <- 4 # degrees of freedom for the t distribution
alpha <- seq(0.001, 0.999, length.out=256) # confidence levels
VaRnorm <- VaR_t(alpha, sigma=V*sig, df=Inf)
VaRt4 <- VaR_t(alpha, sigma=V*sig*sqrt((nu-2)/nu), df=nu)
ESnorm <- ES_t(alpha, sigma=V*sig, df=Inf)
ESt4 <- ES_t(alpha, sigma=V*sig*sqrt((nu-2)/nu), df=nu)
ran <- range(VaRnorm, VaRt4, ESnorm, ESt4)
plot(alpha, VaRnorm, type="l", ylim=ran, xlab=expression(alpha), ylab="")
lines(alpha, VaRt4, col="royalblue3")
lines(alpha, ESnorm, col="darkorange2")
lines(alpha, ESt4, col="maroon3")
legend("bottomright", bty="n", lty=rep(1,4), col=c("black",
       "royalblue3", "darkorange3", "maroon3"),
       legend=c(expression(VaR[alpha]~~"for normal model"),
                expression(VaR[alpha]~~"for "*t[4]*" model"),
                expression(ES[alpha]~~"for normal model"),
                expression(ES[alpha]~~"for "*t[4]*" model")))

Run the code above in your browser using DataLab