Kernel CVaR

The Kernel CVaR is a smoothed Historical CVaR: the average return below the Kernel VaR under a Gaussian kernel density of the returns.

The formula for the Kernel CVaR first sets the bandwidth h, how far each return is smoothed out, with Silverman’s rule from the sample standard deviation Std of the n returns:

\[h = \text{Std} \cdot \left(\frac{4}{3 \cdot n}\right)^{1/5}\]

Each return \(\text{Return}_{i}\) then becomes a small normal curve of width h around it, and the Kernel VaR is the level below which these curves together hold the tail probability alpha (0.05 for the 95% confidence level), with NormalCDF the standard normal distribution function:

\[\operatorname{mean}\left(\text{NormalCDF}\left(\frac{\text{Kernel VaR} - \text{Return}_{i}}{h}\right)\right) = \alpha\]

The Kernel CVaR is the average of the smoothed density below that level, which has a closed form in the distance \(u_{i}\) of each return to the Kernel VaR, with NormalPDF the standard normal density:

\[u_{i} = \frac{\text{Kernel VaR} - \text{Return}_{i}}{h}\] \[\text{Kernel CVaR} = \frac{\operatorname{mean}\left(\text{Return}_{i} \cdot \text{NormalCDF}(u_{i}) - h \cdot \text{NormalPDF}(u_{i})\right)}{\alpha}\]

It keeps the shape of the history but moves less from one window to the next than the Historical CVaR.

The Conditional Value at Risk (CVaR), also called the Expected Shortfall (ES), is the average return of the periods that fall at or below the Value at Risk (VaR). Where the VaR says how bad a period gets at the chosen confidence level, the CVaR says how bad the periods beyond it are on average: a 5% CVaR of -0.045 means that the worst one in twenty periods lose 4.5% on average. At the same alpha the CVaR is always at least as bad as the VaR, and the gap between the two shows how fat the tail is.

The CVaR exists because the VaR has two flaws. Artzner, Delbaen, Eber and Heath (1999) set out the properties a coherent risk measure needs, and the VaR fails one of them, subadditivity: the VaR of a portfolio can exceed the sum of the VaRs of its parts, so it can penalise diversification. The VaR also ignores everything beyond its quantile, so a position with rare but catastrophic losses can have the same VaR as a much safer one. The CVaR is coherent (Acerbi and Tasche, 2002) and weighs the size of the losses in the tail, and Rockafellar and Uryasev (2000) showed that it can be minimized as a linear program, which made it a standard objective in portfolio optimization. The Basel Committee’s minimum capital requirements for market risk (the Fundamental Review of the Trading Book) replaced the 99% VaR with the 97.5% Expected Shortfall for banks’ market-risk capital.

The CVaR is a return (negative for a loss). It rests on the few returns in the tail (a year of daily returns at the 95% confidence level leaves about 12 days), so a single extreme day can move it a lot; a longer window or a fitted distribution gives a steadier figure. Compare assets over the same period and confidence level. The methods differ in how they estimate the tail, from the plain history to fitted distributions and volatility models.

Several tail probabilities \(\alpha_{1}\) to \(\alpha_{K}\) can be combined into the Weighted Conditional Value at Risk (Weighted CVaR), the weighted sum of the CVaR at each of them.

The formula for the Weighted Conditional Value at Risk is as follows:

\[\text{Weighted CVaR} = \sum_{k=1}^{K} \text{Weight}_{k} \cdot \text{CVaR}(\alpha_{k})\]

Where \(\text{CVaR} (\alpha_{k})\) is the CVaR at the tail probability \(\alpha_{k}\) and \(\text{Weight}_{k}\) its weight. With non-negative weights that sum to 1 this is a spectral risk measure (Acerbi, 2002): it weighs the worst returns more than the CVaR at the largest alpha does, and any weighting of the tail can be built from enough tail probabilities.

Also known as: kernel density CVaR, kernel expected shortfall, smoothed historical CVaR.

In the Finance Toolkit this is get_conditional_value_at_risk with method="kernel", the same function as Conditional Value at Risk (cVaR).

Example · XOM, CVX, COP · 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_conditional_value_at_risk:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["XOM", "CVX", "COP"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2025-01-01",
    end_date="2025-12-31",
)

toolkit.risk.get_conditional_value_at_risk(method="kernel")

Which returns:

References

  • Paper Conditional Value at Risk: Artzner, P., Delbaen, F., Eber, J.-M. and Heath, D. (1999). “Coherent Measures of Risk.” Mathematical Finance, 9(3), 203-228.
  • Paper Conditional Value at Risk: Basel Committee on Banking Supervision (2019). “Minimum capital requirements for market risk.”
  • Paper Weighted CVaR: Acerbi, C. (2002). “Spectral Measures of Risk: A Coherent Representation of Subjective Risk Aversion.” Journal of Banking & Finance, 26(7), 1505-1518.
  • Paper Weighted CVaR: Cajas, D. (2021). “OWA Portfolio Optimization: A Disciplined Convex Programming Framework.” SSRN Electronic Journal.
  • Paper Scaillet, O. (2004). “Nonparametric Estimation and Sensitivity Analysis of Expected Shortfall.” Mathematical Finance, 14(1), 115-129.
  • Paper Silverman, B.W. (1986). “Density Estimation for Statistics and Data Analysis.” Chapman and Hall.
  • Library Referenced against scipy’s gaussian_kde (Kernel CVaR)
Share