Estimating Return VaR from Historical Quantiles
Summary
The document clarifies how a quantile relates to value at risk and why VaR should be calculated from returns rather than raw share prices. A price-series quantile gives a price threshold; it does not directly express the loss on an investment. The response converts the AAPL price observations into discrete daily returns, then applies a 95% VaR calculation to estimate a downside threshold. It reports a VaR of about 3.40% for the sample and suggests plotting returns against that level to inspect how often observations cross it.
This is a historical, sample-based estimate: it summarizes past daily returns and does not establish the probability or size of future losses. The discussion does not resolve the question about forecast distributions, lognormal random walks, or how to simulate and combine paths. The specific result depends on the selected period, return convention, and VaR implementation, and the excerpt gives no broader validation or comparison with alternative risk methods.
Key ideas
- A quantile of share prices is a price boundary, not a return-based loss estimate.
- VaR is more interpretable when calculated from a return series than from raw prices.
- The response estimates 95% VaR from historical discrete daily returns.
- A plot can show how observed returns relate to the estimated VaR threshold.
- Historical VaR describes the sample and does not guarantee future loss limits.
Tags
Full text
# Quantiles, Value-at-Risk and log normal random walks…
# Quantiles, Value-at-Risk and log normal random walks…
Sorry, that's probably quite a bunch of silly questions, but I just got lost a bit and need to dot all the i's and cross some t's :).
Let's say we have a series of returns (like this one we may get in R):
```
library(quantmod)
getSymbols("AAPL")
A <- AAPL[,6]["2007"]
```
Then, if I want to know how much could I lose with the probability 95%, I need to calculate VaR for this 5% quantile, OK? Again, in R first I need to calculate the quantile: `quantile(A, 0.05)`, am I right? The result in this particular series would be 11.485. Which means that with the 95% probability I won't go lower than 11.485, is that right? Thus, my VaR would be then mean(A) - 11.485 = 5.8 or 33.56%, wouldn't it?
In other words, calculating a quantile for a given probability in this particular case gives us a lower boundary corresponding to a series in question, doesn't it? And that's how quantiles are measured, it's not a percentage, but boundaries which with a certain probability limit values of a series?
Now, to the second part :)
While reading the article on Wolfram Alpha, I've noticed that among other things, when asked on a certain stock, WA among other information, also tries to give some predictions. Which are actually quantiles, aren't they? E.g., with the 95% probability they say that the stock in question in one month time won't go lower than 92.67 - and this price, 92.67 would be the 5% quantile for that particular stock during that particular period, right?
If so, now to the most interesting bit: as you may see, they also draw some hypothetical colored graphs there, using log normal random walks, as they say below. But with log normal random walks values one will get may be very different, is that so? Thus, they probably calculate quite a lot of such walks, like hundreds or thousands, and then bootstrap them? If so, then how is that done with R? What is the usual algorithm? Needful libraries? Where should I look to learn more?
Not that I'm interested in predicting stocks, of course :), but I just very much like the idea of trying to predict a distribution...
Thank you.
## Answer by Rime (score 1)
https://quant.stackexchange.com/a/16649
Not too sure about the second part of your questions but as far as `VaR`, R has some pretty neat functions. First I took you subset `A` and converted it to discrete returns since using actual prices for VaR may be a bit harder to interpret.
```
# Load PerformanceAnalytics for VaR & Calculating Returns
library("PerformanceAnalytics")
# Calculate Returns
a <- CalculateReturns(A, method=c("discrete"))
# Calculate VaR at 95% confidence
VaR(a, p=0.95)
```
This results in a `VaR: -0.03399548`. Put simply, One can expected to lose approximately 3.40% on any given day.
Here is a subset of the the function's description.
`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...`
Take a look at the daily returns and the `VaR` level:
```
plot(a)
abline(h=VaR(a,p=0.95), col='red')
```
You see that not many returns fall below the red line which satisfies the 95% confidenceShown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.