ES | R Documentation |
Computes the Expected Shortfall of a given amount of loss based on variance-covariance method.
ES( variance, alpha = 0.95, weights = NULL, model = c("normal", "t-student", "both"), df = NULL, percentage = FALSE )
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 |
A numeric value (either a single one or a vector) consisting of the significance level at which ES has to be computed, it can either be a single numeric value or a vector of numeric values. |
weights |
A vector of weights of size N for weighting the variance of losses.
When |
model |
A character string indicating which distribution is to be used for computing the ES,
the default value is the |
df |
An integer indicating the degrees of freedom for the t-student distribution when setting
|
percentage |
Logical indicating whether the file names in the VaR table should be presented in percentage or decimal. |
ES
computes the Expected Shortfall (ES) of a certaing amount of loss based upon the following general formulation:
ES_\alpha = \frac11-\alpha\int_\alpha^1 VaR_u(X)du = E[X|X > F_X^-1(\alpha)]ES_\alpha = \dfrac11-\alpha\int_\alpha^1 VaR_u(X)du = E[X|X > F_X^-1(\alpha)]
where \mjteqn\alpha\alpha is the significance level, \mjteqnVaR_u(X)VaR_u(X) is the Value-at-Risk of \mjteqnX.X.
ES
for the normal case is based on the following expression:
ES_\alpha = \mu + \sigma \frac\phi(\Phi^-1(\alpha))1-\alphaES_\alpha = \mu + \sigma \frac\phi(\Phi^-1(\alpha))1-\alpha
Meanwhile, ES
for the t-student distribution takes comes from:
ES_\alpha(\tildeX) = \fracg_\upsilon(t_\upsilon^-1(\alpha))1-\alpha \left( \frac\upsilon+(t_\upsilon^-1(\alpha))^2\upsilon - 1 \right)ES_\alpha(\tildeX) = \fracg_\upsilon(t_\upsilon^-1(\alpha))1-\alpha \left( \frac\upsilon+(t_\upsilon^-1(\alpha))^2\upsilon - 1 \right)
Jilber Urbina
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.
McNeil, A. J.; Frey, R. & Embrechts, P. Quantitative risk management: concepts, techniques and tools. Princeton University Press, 2005.
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.
# Exercise 2.21, page 46 in McNeil et al (2005) alpha <- c(.90, .95, .975, .99, .995) (ES(variance=(0.2/sqrt(250))^2, alpha=alpha, model='normal'))*10000 (ES(variance=(0.2/sqrt(250))^2, alpha=alpha, model='t-student', df=4))*10000 # Both type of models at once. (ES(variance=(0.2/sqrt(250))^2, alpha=alpha, model='both', df=4))*10000 # A vector of losses variance <- matrix(c(100,150,150,900), 2) # covariance matrix w <- c(0.5, 0.5) # a vector weights ES(variance=variance, weights=w, alpha=0.95)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.