Calculates Value-at-Risk(VaR) for univariate, component, and marginal cases using a variety of analytical methods.

VaR(R = NULL, p = 0.95, ..., method = c("modified", "gaussian",
  "historical", "kernel"), clean = c("none", "boudt", "geltner"),
  portfolio_method = c("single", "component", "marginal"), weights = NULL,
  mu = NULL, sigma = NULL, m3 = NULL, m4 = NULL, invert = TRUE)

Arguments

R

an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns

p

confidence level for calculation, default p=.95

any other passthru parameters

method

one of "modified","gaussian","historical", "kernel", see Details.

clean

method for data cleaning through Return.clean. Current options are "none", "boudt", or "geltner".

portfolio_method

one of "single","component","marginal" defining whether to do univariate, component, or marginal calc, see Details.

weights

portfolio weighting vector, default NULL, see Details

mu

If univariate, mu is the mean of the series. Otherwise mu is the vector of means of the return series, default NULL, see Details

sigma

If univariate, sigma is the variance of the series. Otherwise sigma is the covariance matrix of the return series, default NULL, see Details

m3

If univariate, m3 is the skewness of the series. Otherwise m3 is the coskewness matrix (or vector with unique coskewness values) of the returns series, default NULL, see Details

m4

If univariate, m4 is the excess kurtosis of the series. Otherwise m4 is the cokurtosis matrix (or vector with unique cokurtosis values) of the return series, default NULL, see Details

invert

TRUE/FALSE whether to invert the VaR measure. see Details.

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 judgment 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.

Background

This function provides several estimation methods for the Value at Risk (typically written as VaR) of a return series and the Component VaR of a portfolio. Take care to capitalize VaR in the commonly accepted manner, to avoid confusion with var (variance) and VAR (vector auto-regression). VaR is an industry standard for measuring downside risk. For a return series, VaR is defined as the high quantile (e.g. ~a 95 quantile) of the negative value of the returns. This quantile needs to be estimated. With a sufficiently large data set, you may choose to utilize the empirical quantile calculated using 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 VaR can be more appropriate. For the VaR of a portfolio, it is also of interest to decompose total portfolio VaR into the risk contributions of each of the portfolio components. For the above mentioned VaR estimators, such a decomposition is possible in a financially meaningful way.

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.

Gourieroux, 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, L. and Ziemann, V., 2010. Improved estimates of higher-order comoments and implications for portfolio selection. Review of Financial Studies, 23(4):1467-1502.

Return to RiskMetrics: Evolution of a Standard https://www.msci.com/documents/10199/dbb975aa-5dc2-4441-aa2d-ae34ab5f0945

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

Rockafellar, Terry and Uryasev, Stanislav. Optimization of Conditional VaR. The Journal of Risk, 2000, vol. 2, 21-41.

Dowd, Kevin. Measuring Market Risk, John Wiley and Sons, 2010.

Jorian, Phillippe. Value at Risk, the new benchmark for managing financial risk. 3rd Edition, McGraw Hill, 2006.

Hallerback, John. "Decomposing Portfolio Value-at-Risk: A General Analysis", 2003. The Journal of Risk vol 5/2.

Yamai and Yoshiba (2002). "Comparative Analyses of Expected Shortfall and Value-at-Risk: Their Estimation Error, Decomposition, and Optimization", Bank of Japan.

See also

SharpeRatio.modified chart.VaRSensitivity Return.clean

Examples

data(edhec) # first do normal VaR calc VaR(edhec, p=.95, method="historical")
#> Convertible Arbitrage CTA Global Distressed Securities Emerging Markets #> VaR -0.01916 -0.0354 -0.018875 -0.044605 #> Equity Market Neutral Event Driven Fixed Income Arbitrage Global Macro #> VaR -0.006385 -0.02254 -0.00929 -0.01624 #> Long/Short Equity Merger Arbitrage Relative Value Short Selling #> VaR -0.02544 -0.013455 -0.013175 -0.07848 #> Funds of Funds #> VaR -0.021265
# now use Gaussian VaR(edhec, p=.95, method="gaussian")
#> Convertible Arbitrage CTA Global Distressed Securities Emerging Markets #> VaR -0.02645782 -0.03471098 -0.0221269 -0.05498927 #> Equity Market Neutral Event Driven Fixed Income Arbitrage Global Macro #> VaR -0.008761813 -0.02246202 -0.01900198 -0.02023018 #> Long/Short Equity Merger Arbitrage Relative Value Short Selling #> VaR -0.02859264 -0.01152478 -0.01493049 -0.08617027 #> Funds of Funds #> VaR -0.02393888
# now use modified Cornish Fisher calc to take non-normal distribution into account VaR(edhec, p=.95, method="modified")
#> Convertible Arbitrage CTA Global Distressed Securities Emerging Markets #> VaR -0.03247395 -0.03380228 -0.0274924 -0.06363081 #> Equity Market Neutral Event Driven Fixed Income Arbitrage Global Macro #> VaR -0.01134637 -0.02812515 -0.0246791 -0.01548247 #> Long/Short Equity Merger Arbitrage Relative Value Short Selling #> VaR -0.03037494 -0.01486869 -0.01926435 -0.07431463 #> Funds of Funds #> VaR -0.02502852
# now use p=.99 VaR(edhec, p=.99)
#> Convertible Arbitrage CTA Global Distressed Securities Emerging Markets #> VaR -0.1009223 -0.04847019 -0.06533764 -0.1397195 #> Equity Market Neutral Event Driven Fixed Income Arbitrage Global Macro #> VaR -0.04404136 -0.06385154 -0.05850228 -0.02437999 #> Long/Short Equity Merger Arbitrage Relative Value Short Selling #> VaR -0.05508705 -0.03630211 -0.050531 -0.122236 #> Funds of Funds #> VaR -0.05500037
# or the equivalent alpha=.01 VaR(edhec, p=.01)
#> Convertible Arbitrage CTA Global Distressed Securities Emerging Markets #> VaR -0.1009223 -0.04847019 -0.06533764 -0.1397195 #> Equity Market Neutral Event Driven Fixed Income Arbitrage Global Macro #> VaR -0.04404136 -0.06385154 -0.05850228 -0.02437999 #> Long/Short Equity Merger Arbitrage Relative Value Short Selling #> VaR -0.05508705 -0.03630211 -0.050531 -0.122236 #> Funds of Funds #> VaR -0.05500037
# now with outliers squished VaR(edhec, clean="boudt")
#> Error: requireNamespace("robustbase", quietly = TRUE) is not TRUE
# add Component VaR for the equal weighted portfolio VaR(edhec, clean="boudt", portfolio_method="component")
#> no weights passed in, assuming equal weighted portfolio
#> Error: requireNamespace("robustbase", quietly = TRUE) is not TRUE