Using only knowledge from Chapters 2, 4, and 5 of SDAFE
Andrew Pua
2024-06-14
Motivation
The worst that could happen is we lose everything due to changes in prices. This means that the net return is \(R_t = -1\).
But this is not very useful as a way to measure market risk.
We need a meaningful and quantifiable measure of risk which incorporates the uncertainty of returns.
Value at risk (VaR)
Think of loss as monetary loss in positive terms.
Usually, we write \(-350\) pesos to represent loss.
But in Chapter 19, it is represented as a loss of 350 pesos.
Fix a horizon \(T\) and a confidence coefficient \(1-\alpha\).
The phrase “confidence coefficient” is technically and conceptually different from confidence level.
Value at risk (VaR)
Let \(\mathcal{L}\) be the loss over the holding period \(T\). Then the \(\mathsf{VaR}(\alpha)\) is the \(\alpha\)th upper quantile of \(\mathcal{L}\).
For simplicity, we focus on continuous loss distributions. By definition, we have \[\mathbb{P}\left(\mathcal{L} > \mathsf{VaR}(\alpha)\right)=\alpha.\]
There is a \(100\alpha\)% chance of a loss exceeding \(\mathsf{VaR}(\alpha)\) over the holding period \(T\).
Value at risk (VaR)
You can frame VaR as:
Rule out the \(100\alpha\)% worst things that might happen over some holding period.
How low could my investment go if I exclude the worst \(100\alpha\)% of outcomes?
Example 19.1
Yearly returns of a stock are normally distributed with mean 0.04 and standard deviation 0.18.
If you have $100,000 worth of stock, what is the VaR for a holding period of 1 year?
Apply Chapters 2 and 4 only: Require knowledge of normal distributions and quantiles.
Pay attention book has an egregious typo!
Example 19.1
Very unrealistic!
Requires you know the distribution of returns
Requires you know the population mean and population standard deviation of the yearly returns
Admittedly, easy to calculate.
Have to believe that stationarity also holds over the holding period.
Directions
VaR works by excluding the worst \(100\alpha\)% of outcomes.
But those excluded losses may materialize and your risk measure fails to account for that!
Use an alternative measure called expected shortfall.
Directions
Even if you are willing to accept VaR deficiencies, Example 19.1 is only a baseline.
You must estimate the distribution of returns and/or some its features.
Use some nonparametric approaches from Chapter 4.
Use parametric approaches from Chapter 5.
You must accept that there is uncertainty in your measurements too.
Leads to Chapter 6 on the bootstrap.
Expected shortfall
Define expected shortfall \(\mathsf{ES}(\alpha)\) as \[\mathsf{ES}(\alpha)=\frac{\int_0^{\alpha} \mathsf{VaR}(u)\, du }{\alpha}\] or \[\mathsf{ES}(\alpha)=\mathbb{E}\left(\mathcal{L} | \mathcal{L} > \mathsf{VaR}(\alpha)\right)\]
Best prediction of the losses given that losses exceed a threshold
Estimating VaR and ES
Nonparametrically: no model assumed
Parametrically: by assuming a model for returns
In both cases, you use historical data and assume stationarity.
As of this moment, you have to also assume independence, which may not be plausible.
Nonparametric estimation of VaR
Let \(S>0\) be your fixed position denominated in a particular currency.
Let \(R\) be returns which are treated as random variables having common cdf \(F\).
But \(F\) is unknown. So we estimate it using the empirical cdf. Therefore, \[\widehat{\mathsf{VaR}}^{\mathsf{np}}(\alpha)=-S\times \widehat{F}^{-1}(\alpha).\]
The sample -quantile of the observed distribution of returns is \(\widehat{F}^{-1}(\alpha)\).
Nonparametric estimation of ES
Since expected shortfall is \[\mathsf{ES}(\alpha)=\mathbb{E}\left(\mathcal{L} | \mathcal{L} > \mathsf{VaR}(\alpha)\right),\] we can directly estimate this by taking averages.
Two unknowns here:
Population mean \(\mathbb{E}(\cdot)\) is involved.
\(\mathsf{VaR}(\alpha)\) has to be estimated.
Nonparametric estimation of ES
Estimate \(\mathsf{VaR}(\alpha)\) using \(\widehat{\mathsf{VaR}}^{\mathsf{np}}(\alpha)\).
Use a sample average to estimate the population average! Method of moments showing up here.
Note that you should be plugging in consistent estimators for the unknown quantities.
Suppose you assume a parametric model for the returns and that \(\boldsymbol\theta\) is a vector of parameters.
Instead of looking at \(F^{-1}(\alpha)\), we look at \(F^{-1}(\alpha | \boldsymbol\theta)\).
Estimate \(F^{-1}(\alpha | \boldsymbol\theta)\) using \(F^{-1}(\alpha | \widehat{\boldsymbol\theta})\).
So, we have \[\widehat{\mathsf{VaR}}^{\mathsf{par}}(\alpha)=-S\times F^{-1}(\alpha | \widehat{\boldsymbol\theta}).\]
Parametric estimation of ES
The approach is very similar to the nonparametric approach.
The difference is that there is a general form of the ES and there are specific forms of the ES depending on the assumed distribution for returns.
Note that \[\begin{eqnarray*}\mathsf{ES}(\alpha)&=&\mathbb{E}\left(\mathcal{L} | \mathcal{L} > \mathsf{VaR}(\alpha)\right)\\ &=&\mathbb{E}\left(-S\times R | -S\times R > -S\times F^{-1}(\alpha) \right) \\
&=& -S\times \mathbb{E}\left( R | R < F^{-1}(\alpha) \right)\end{eqnarray*}\]
Parametric estimation of ES
As a result, we have \[\begin{eqnarray*}\mathsf{ES}(\alpha) &=& -S\times \frac{\displaystyle\int_{-\infty}^{F^{-1}(\alpha)} xf(x)\, dx}{\mathbb{P}\left(R<F^{-1}(\alpha)\right)} \\
&=& -\frac{S}{\alpha}\times \int_{-\infty}^{F^{-1}(\alpha)} xf(x)\, dx \end{eqnarray*}\]
Parametric estimation of ES
In the parametric approach, the cdf \(F\) and the density \(f\) are all completely specified. Therefore, \[\begin{eqnarray*}\mathsf{ES}(\alpha) &=& -\frac{S}{\alpha}\times \int_{-\infty}^{F^{-1}(\alpha |\boldsymbol\theta)} xf(x |\boldsymbol\theta)\, dx \end{eqnarray*}\]
Parametric estimation of ES
Plug-in estimates for unknown quantities obtained under the assumed model: \[\begin{eqnarray*}\widehat{\mathsf{ES}}^{\mathsf{par}}(\alpha) &=& -\frac{S}{\alpha}\times \int_{-\infty}^{F^{-1}(\alpha |\widehat{\boldsymbol\theta})} xf(x|\widehat{\boldsymbol\theta})\, dx \end{eqnarray*}\]
Parametric estimation of ES
It may be possible to obtain a closed-form expression for the ES.
For the case of normally distributed returns \(N(\mu,\sigma^2)\): \[\mathsf{ES}^{\mathsf{norm}}(\alpha)= S\times \left\{-\mu+\sigma \left(\frac{\phi(\Phi^{-1}(\alpha))}{\alpha}\right)\right\}.\]
For the case of \(t_{\nu}\left(\mu,\lambda^2\right)\) distributed returns: \[\mathsf{ES}^{\mathsf{t}}(\alpha)= S\times \left\{-\mu+\lambda \left(\frac{f_{\nu}(F_{\nu}^{-1}(\alpha))}{\alpha}\left[\frac{\nu+\left(F_{\nu}^{-1}(\alpha)\right)^2}{\nu-1}\right]\right)\right\}.\]
Code in book versus code in slides
The book has some extra lines of code which are unnecessary, e.g. lines 4, 5 in page 556.
The book uses MASS::fitdistr() to fit parametric distributions.
The slides streamline the code and you could streamline it further to remove the lines which display the results.
The slides start from the raw data, include optimization of a log-likelihood, and show everything until the communication of the final results.
PSEi illustration with daily returns
Suppose you hold a 20,000 peso position in a PSEi index fund (if it exists).
Find a 1-day or 24-h \(\mathsf{VaR}(0.05)\).
Find the expected shortfall based on the earlier VaR.
Provide nonparametric and parametric estimates of these quantities.
The code in the book uses a subset of the daily returns. Try using different subsets to see how sensitive your VaR is to the length of historical data you are using.
R Lab Problem 1
Connection to ES calculations for the \(t\)-distribution