NxCVaR - Calculates the Conditional Value at Risk

Returns the historical/theoretical conditional value at risk (CVaR).

Syntax

NxCVaR(X, C, Method, Distribution)

X
is the portfolio rate of returns data series (a one-dimensional array of cells (e.g., rows or columns)).
C
is the statistical confidence level for calculating the VaR. If missing, a confidence value of 95% is assumed.
Method
is an integer switch to select the method for calculating the VaR : (0 = Historical (default), 1 = KDE, 2 = Theoretical). 
Value Description
0 Historical (default).
1 Kernel Density Estimation (KDE).
2 Theoretical.
Distribution
is an integer switch to select the underlying theoretical distribution : (0 = Gaussian (default), 1 = Log-Normal)
Value Distribution
0 Gaussian Distribution(default).
1 Log-Normal Distribution.

  Status

The NxCVaR function is available starting with NumXL version 1.68 CAMEL.

Remarks

  1. By definition, all values in the input data set (i.e., X) must be greater than -1.0.
  2. The input data series may include missing values (e.g., #N/A, #VALUE!, #NUM!, empty cell), but they will not be included in the calculations.
  3. CVaR is a risk assessment measure that quantifies the amount of tail risk an investment portfolio has. CVaR quantifies the expected losses that occur beyond the VaR breakpoint.
  4. CVaR is derived by taking a weighted average of the losses in the tail of the distribution of possible returns beyond the value at risk (VaR) cutoff point. 
    $$\textrm{CVaR}=\textrm{CVaR}=E\left[x | x< \textrm{VaR} \right ]$$ $$\textrm{CVaR}=\frac{1}{1-c}\times\int_{-1}^{\textrm{VaR}}{x.p(x).dx}$$ Where:
    • $c$ is the statistical confidence level for calculating the VaR (e.g., 95%).
    • $p(.)$ is the probability density function.
    • $\textrm{VaR}$ is the value at risk (VaR) level for the confidence level c.
  5. There are three main ways of computing CVaR:
    1. The first is the historical method, which looks at one's prior returns history. In this method, VAR is determined by taking the returns belonging to the lowest quintile of the series (identified by the confidence level).
    2. The second is the variance-covariance method. Instead, this method assumes that gains and losses are normally distributed (or logNormal).
      Normal (Gaussian) distribution: $$\textrm{CVaR} = -\mu + \sigma \frac {\varphi (\Phi ^{-1}(1-c))}{1-c}$$ Where:
      • $c$ is the statistical confidence level for calculating the VaR (e.g., 95%).
      • $\varphi(.)$ is the standard normal probability density function (PDF).
      • $\Phi(.)$ s the standard normal cumulative density function (CDF).
      • $\Phi^{-1}(.)$ is the standard inverse normal CDF or quantile.
      • $\mu$ is the mean of the Gaussian distribution.
      • $\sigma$ is the standard deviation of the Gaussian distribution.
      Log-Normal Distribution $$\textrm{CVaR} = 1-\exp \left(\mu +{\frac {\sigma ^{2}}{2}}\right){\frac {\Phi \left(\Phi ^{-1}(1-c )-\sigma \right)}{1-c }}$$ Where:
      • $c$ is the statistical confidence level for calculating the VaR (e.g., 95%).
      • $\Phi(.)$ is the standard normal CDF.
      • $\Phi^{-1}(.)$ is the standard inverse normal CDF or quantile.
      • $\mu$ is the mean of the Gaussian distribution.
      • $\sigma$ is the standard deviation of the Gaussian distribution.
    3. A final approach to VaR is to conduct a Monte Carlo simulation.
  6. Conditional value at risk (CVaR) is also called expected shortfall, average value at risk (VaR), expected tail loss (ETL), and super-quantile.
  7. The CVaR value of the boundary conditions is as follows:
    1. For the zero(0) confidence level, the CVaR is equal to the mean.
    2. For the 100% confidence level, the CVaR and the VaR equal -1.0.

Examples

Example 1:

 
1
2
3
4
5
6
7
8
9
10
11
12
A B C
Date Fund Index
1/1/2017 #N/A #N/A
2/1/2017 0.030 0.020
3/1/2017 0.020 -0.040
4/1/2017 -0.007 -0.007
5/1/2017 0.055 0.055
6/1/2017 0.028 0.028
7/1/2017 0.002 0.002
8/1/2017 -0.117 -0.10
9/1/2017 0.012 0.02
10/1/2017 0.021 0.021
11/1/2017 0.111 0.05



Formula Description (Result)
=NxCVaR(\$B\$2:\$B\$14,0.95, 0) CVaR (historical) (-0.07844)
=NxCVaR(\$B\$2:\$B\$14,0.95, 1) CVaR (Normal) (-0.07844)
=NxCVaR(\$B\$2:\$B\$14,0.95, 2) CVaR (Log-Normal) (-0.07809)

Files Examples

Related Links

References

Comments

Please sign in to leave a comment.

Was this article helpful?
3 out of 3 found this helpful