R calculate various Value at Risk (VaR) measures

Post on: 11 Апрель, 2015 No Comment

R calculate various Value at Risk (VaR) measures

Univariate VaR estimation methods

The VaR at a probability level p (e.g. 95%) is the p -quantile of the negative returns, or equivalently, is the negative value of the c=1-p quantile of the returns. In a set of returns for which sufficently long history exists, the per-period Value at Risk is simply the quantile of the period negative returns.

VaR=quantile(-R,p)

where q_<.99> is the 99% empirical quantile of the negative return series.

This method is also sometimes called historical VaR, as it is by definition ex post analysis of the return distribution, and may be accessed with method=historical.

www.riskmetrics.com/publications/techdocs/r2rovv.html.

Parametric mean-VaR 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 Rsim N(mu,sigma) for the return series. In this case, estimation of VaR requires the mean return bar. the return distribution and the variance of the returns sigma. In the most common case, parametric VaR is thus calculated by

sigma=var(R)

VaR= -mean(R) — sqrt(sigma)*qnorm(c)

where z_ is the c -quantile of the standard normal distribution. Represented in R by qnorm(c). and may be accessed with method=gaussian.

Other forms of parametric mean-VaR estimation utilize a different distribution for the distribution of losses to better account for the possible fat-tailed nature of downside risk. The package VaR contains methods for simulating and estimating lognormal VaR.norm and generalized Pareto VaR.gpd distributions to overcome some of the problems with nonparametric or parametric mean-VaR calculations on a limited sample size or on potentially fat-tailed distributions. There is also a VaR.backtest function to apply simulation methods to create a more robust estimate of the potential distribution of losses. Less commonly a covariance matrix of multiple risk factors may be applied.

The limitations of mean Value-at-Risk are well covered in the literature. The limitations of traditional mean-VaR are all related to the use of a symetrical distribution function. Use of simulations, resampling, or Pareto distributions all help in making a more accurate prediction, but they are still flawed for assets with significantly non-normal (skewed or kurtotic) distributions. Zangari (1996) and Favre and Galeano(2002) provide a modified VaR 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) mean-VaR if the return stream follows a standard distribution. This measure is now widely cited and used in the literature, and is usually referred to as Modified VaR or Modified Cornish-Fisher VaR. They arrive at their modified VaR calculation in the following manner:

z_cf=z_c+[(z_c^2-1)S]/6+[(z_c^3-3z_c)K]/24-[(2z_c^3-5z_c)S^2]/36

VaR= -mean(R) — sqrt(sigma)*z_cf

where S is the skewness of R and K is the excess kurtosis of R.

Cornish-Fisher VaR collapses to traditional mean-VaR when returns are normally distributed. As such, the VaR and VaR functions are wrappers for the VaR function. The Cornish-Fisher expansion also naturally encompasses much of the variability in returns that could be uncovered by more computationally intensive techniques such as resampling or Monte-Carlo simulation. This is the default method for the VaR function, and may be accessed by setting method=modified.

Favre and Galeano also utilize modified VaR in a modified Sharpe Ratio as the return/risk measure for their portfolio optimization analysis, see SharpeRatio.modified for more information.

Component VaR

By setting portfolio_method=component you may calculate the risk 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 VaR, the scalar contribution of each component to the portfolio VaR (these will sum to the portfolio VaR), and a percentage risk contribution (which will sum to 100%).

Both the numerical and percentage component contributions to VaR may contain both positive and negative contributions. A negative contribution to Component VaR indicates a portfolio risk diversifier. Increasing the position weight will reduce overall portoflio VaR.

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 naïve 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 VaR contribution as the weight of the position in the portfolio times the partial derivative of the portfolio VaR with respect to the component weight.

C[i]VaR = w[i]*(dVaR/dw[i]).

Because the portfolio VaR is linear in position size, we have that by Euler’s theorem the portfolio VaR is the sum of these risk contributions. Gouriéroux (2000) shows that for VaR, 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 equals the negative portfolio VaR:

C[i]VaR = -E( w[i]r[i]|rp=-VaR )

For the decomposition of Gaussian VaR, the estimated mean and covariance matrix are needed. For the decomposition of modified VaR, 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[ (r — mu)(r — mu)’ %x% (r — mu)’]

The N times N^3 co-kurtosis matrix is

E[ (r — mu)(r — mu)’ %x% (r — mu)’%x% (r — mu)’]

where %x% stands for the Kronecker product. The matrices can be estimated through the functions skewness.MM and kurtosis.MM. More efficient estimators have been 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 VaR measure is robust to single outliers. This is especially the case for modified VaR and its 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.

Epperlein and Smillie (2006) introduced a non-parametric kernel estimator for component risk contributions, which is available via method=kernel and portfolio_method=component.

Marginal VaR

Different papers call this different things. In the Denton and Jayaraman paper referenced here, this calculation is called Incremental VaR. We have chosen the more common usage of calling this difference in VaR’s in portfolios without the instrument and with the instrument as the difference at the Margin, thus the name Marginal VaR. This is incredibly confusing, and hasn’t been resolved in the literature at this time. Simon Keel and David Ardia (2009) attempt to reconcile some of the definitional issues and address some of the shortcomings of this measure in their working paper titled Generalized Marginal Risk. Hopefully their improved Marginal Risk measures may be included here in the future.

Note

The option to invert the VaR measure should appease both academics and practitioners. The mathematical definition of VaR as the negative value of a quantile will (usually) produce a positive number. Practitioners will argue that VaR denotes a loss, and should be internally consistent with the quantile (a negative number). For tables and charts, different preferences may apply for clarity and compactness. As such, we provide the option, and set the default to TRUE to keep the return consistent with prior versions of PerformanceAnalytics, but make no value judgement on which approach is preferable.

The prototype of the univariate Cornish Fisher VaR function was completed by Prof. Diethelm Wuertz. All corrections to the calculation and error handling are the fault of Brian Peterson.

Author(s)

Brian G. Peterson and Kris Boudt

References

Boudt, Kris, Peterson, Brian, and Christophe Croux. 2008. Estimation and decomposition of downside risk for portfolios with non-normal returns. 2008. The Journal of Risk, vol. 11, 79-103.

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.

Denton M. and Jayaraman, J.D. Incremental, Marginal, and Component VaR. Sunguard. 2004.

Epperlein, E. Smillie, A. Cracking VaR with kernels. RISK, 2006, vol. 19, 70-74.

Gouriéroux, Christian, Laurent, Jean-Paul and Olivier Scaillet. Sensitivity analysis of value at risk. Journal of Empirical Finance, 2000, Vol. 7, 225-245.

Keel, Simon and Ardia, David. Generalized marginal risk. Aeris CAPITAL discussion paper.

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.

Zangari, Peter. A VaR Methodology for Portfolios that include Options. 1996. RiskMetrics Monitor, First Quarter, 4-12.


Categories
Options  
Tags
Here your chance to leave a comment!