ES(R=NULL, p = 0.95, ..., method = c("modified", "gaussian", "historical",
"kernel"), clean = c("none", "boudt","geltner"), portfolio_method = c("single",
"component"), weights = NULL, mu = NULL, sigma = NULL, m3 = NULL, m4 = NULL,
invert = TRUE, operational = TRUE)
ETL(R=NULL, p = 0.95, ..., method = c("modified", "gaussian", "historical",
"kernel"), clean = c("none", "boudt","geltner"), portfolio_method = c("single",
"component"), weights = NULL, mu = NULL, sigma = NULL, m3 = NULL, m4 = NULL,
invert = TRUE, operational = TRUE)
CVaR(R=NULL, p = 0.95, ..., method = c("modified", "gaussian", "historical",
"kernel"), clean = c("none", "boudt","geltner"), portfolio_method = c("single",
"component"), weights = NULL, mu = NULL, sigma = NULL, m3 = NULL, m4 = NULL,
invert = TRUE, operational = TRUE)
Return.clean
.
Current options are "none", "boudt", or "geltner".At a preset probability level denoted $c$, which typically is between 1 and 5 per cent, the ES of a return series is the negative value of the expected value of the return when the return is less than its $c$-quantile. Unlike value-at-risk, conditional value-at-risk has all the properties a risk measure should have to be coherent and is a convex function of the portfolio weights (Pflug, 2000). With a sufficiently large data set, you may choose to estimate ES with the sample average of all returns that are below the $c$ empirical quantile. More efficient estimates of VaR are obtained if a (correct) assumption is made on the return distribution, such as the normal distribution. If your return series is skewed and/or has excess kurtosis, Cornish-Fisher estimates of ES can be more appropriate. For the ES of a portfolio, it is also of interest to decompose total portfolio ES into the risk contributions of each of the portfolio components. For the above mentioned ES estimators, such a decomposition is possible in a financially meaningful way.
method="historical"
.When you don't have a sufficiently long set of returns to use non-parametric or historical ES, or wish to more closely model an ideal distribution, it is common to us a parmetric estimate based on the distribution. Parametric ES does a better job of accounting for the tails of the distribution by more precisely estimating shape of the distribution tails of the risk quantile. The most common estimate is a normal (or Gaussian) distribution $R\sim N(\mu,\sigma)$ for the return series. In this case, estimation of ES requires the mean return $\bar{R}$, the return distribution and the variance of the returns $\sigma$. In the most common case, parametric ES is thus calculated by
$$\sigma=variance(R)$$
$$ES=-\bar{R} + \sqrt{\sigma} \cdot \frac{1}{c}\phi(z_{c})$$
where $z_{c}$ is the $c$-quantile of the standard normal distribution. Represented in Rby qnorm(c)
,
and may be accessed with method="gaussian"
. The function $\phi$ is the Gaussian density function.
The limitations of Gaussian ES are well covered in the literature, since most financial return series are non-normal. Boudt, Peterson and Croux (2008) provide a modified ES calculation that takes the higher moments of non-normal distributions (skewness, kurtosis) into account through the use of a Cornish-Fisher expansion, and collapses to standard (traditional) Gaussian ES if the return stream follows a standard distribution. More precisely, for a loss probability $c$, modified ES is defined as the negative of the expected value of all returns below the $c$ Cornish-Fisher quantile and where the expectation is computed under the second order Edgeworth expansion of the true distribution function. Modified expected shortfall should always be higher than modified Value at Risk. Due to estimation problems, this might not always be the case. Set Operational = TRUE to replace modified ES with modified VaR in the (exceptional) case where the modified ES is smaller than modified VaR.
portfolio_method="component"
you may calculate the ES
contribution of each element of the portfolio. The return from the function in
this case will be a list with three components: the univariate portfolio ES, the
scalar contribution of each component to the portfolio ES (these will sum to the
portfolio ES), and a percentage risk contribution (which will sum to 100%). Both the numerical and percentage component contributions to ES may contain both positive and negative contributions. A negative contribution to Component ES indicates a portfolio risk diversifier. Increasing the position weight will reduce overall portoflio ES.
If a weighting vector is not passed in via weights
, the function will assume an equal weighted (neutral) portfolio.
Multiple risk decomposition approaches have been suggested in the literature. A naive approach is to set the risk contribution equal to the stand-alone risk. This approach is overly simplistic and neglects important diversification effects of the units being exposed differently to the underlying risk factors. An alternative approach is to measure the ES contribution as the weight of the position in the portfolio times the partial derivative of the portfolio ES with respect to the component weight. $$C_i \mbox{ES} = w_i \frac{ \partial \mbox{ES} }{\partial w_i}.$$ Because the portfolio ES is linear in position size, we have that by Euler's theorem the portfolio VaR is the sum of these risk contributions. Scaillet (2002) shows that for ES, this mathematical decomposition of portfolio risk has a financial meaning. It equals the negative value of the asset's expected contribution to the portfolio return when the portfolio return is less or equal to the negative portfolio VaR: $$C_i \mbox{ES} = = -E\left[ w_i r_{i} | r_{p} \leq - \mbox{VaR}\right]$$
For the decomposition of Gaussian ES, the estimated mean and covariance matrix are needed. For the decomposition of modified ES,
also estimates of the coskewness and cokurtosis matrices are needed. If $r$ denotes the $Nx1$ return vector and $mu$ is
the mean vector, then the $N \times N^2$ co-skewness matrix is
$$m3 = E\left[ (r - \mu)(r - \mu)' \otimes (r - \mu)'\right]$$
The $N \times N^3$ co-kurtosis matrix is
$$m_{4} =
E\left[ (r - \mu)(r - \mu)' \otimes (r - \mu)'\otimes (r - \mu)'
\right]$$ where $\otimes$ stands for the Kronecker product. The matrices can be estimated through the functions
skewness.MM
and kurtosis.MM
. More efficient estimators were proposed by Martellini and Ziemann (2007) and will be implemented in the future.
As discussed among others in Cont, Deguest and Scandolo (2007), it is important that the estimation of the ES measure
is robust to single outliers. This is especially the case for modified VaR/ES and its component decomposition, since they use higher order moments.
By default, the portfolio moments are estimated by their sample counterparts. If clean="boudt"
then the $1-p$ most extreme observations
are winsorized if they are detected as being outliers. For more information, see Boudt, Peterson and Croux (2008) and Return.clean
. If your data consist of returns for highly illiquid assets, then clean="geltner"
may be more appropriate to reduce distortion caused by autocorrelation, see Return.Geltner
for details.
Cont, Rama, Deguest, Romain and Giacomo Scandolo. Robustness and sensitivity analysis of risk measurement procedures. Financial Engineering Report No. 2007-06, Columbia University Center for Financial Engineering.
Laurent Favre and Jose-Antonio Galeano. Mean-Modified Value-at-Risk Optimization with Hedge Funds. Journal of Alternative Investment, Fall 2002, v 5.
Martellini, Lionel, and Volker Ziemann. Improved Forecasts of Higher-Order Comoments and Implications for Portfolio Selection. 2007. EDHEC Risk and Asset Management Research Centre working paper.
Pflug, G. Ch. Some remarks on the value-at-risk and the conditional value-at-risk. In S. Uryasev, ed., Probabilistic Constrained Optimization: Methodology and Applications, Dordrecht: Kluwer, 2000, 272-281.
Scaillet, Olivier. Nonparametric estimation and sensitivity analysis of expected shortfall. Mathematical Finance, 2002, vol. 14, 74-86.
VaR
SharpeRatio.modified
chart.VaRSensitivity
Return.clean
data(edhec)
# first do normal ES calc
ES(edhec, p=.95, method="historical")
# now use Gaussian
ES(edhec, p=.95, method="gaussian")
# now use modified Cornish Fisher calc to take non-normal distribution into account
ES(edhec, p=.95, method="modified")
# now use p=.99
ES(edhec, p=.99)
# or the equivalent alpha=.01
ES(edhec, p=.01)
# now with outliers squished
ES(edhec, clean="boudt")
# add Component ES for the equal weighted portfolio
ES(edhec, clean="boudt", portfolio_method="component")
Run the code above in your browser using DataLab