Forecasting Parametric Value at Risk with Student’s t Returns
Summary
The document distinguishes a historical quantile estimate from a parametric Value-at-Risk forecast based on Student’s t returns. It describes fitting a t-distribution to log returns, then estimating a one-day-ahead VaR by taking a lower-tail quantile from the forecast distribution. A Monte Carlo estimate can approximate that quantile by simulating returns; it may differ from a direct quantile calculation because of simulation error and implementation choices.
For forecasting, the response recommends estimating distribution parameters using only information available before each forecast, with either a fixed-length rolling window or a growing expanding window. It suggests assessing forecasts out of sample using failure rates or unconditional and conditional coverage tests. The example raises a potential issue with repeatedly adding simulated draws in a loop: that does not by itself represent a sequence of forecast days. The method also depends on an appropriate distributional fit and correctly specified scaling and timing.
Key ideas
- A fitted Student’s t distribution provides a parametric model for return quantiles.
- Monte Carlo VaR is estimated from the lower tail of simulated returns and can vary due to sampling error.
- One-day-ahead forecasts require parameters estimated using only prior information.
- Rolling and expanding windows offer alternative ways to update distribution parameters.
- Out-of-sample failure rates and coverage tests can assess VaR forecasts.
Tags
Full text
# Simulating the Value-at-Risk with $t$ distributed returns
# Simulating the Value-at-Risk with $t$ distributed returns
I want to understand how the value at risk and the simulating the VaR with simple Monte Carlo method. But I want just a confirmation and are welcome any comments, since I don't have the full picture of this calculations.
Let's say that I have an annual asset with one period of margin risk:
```
library(quantmod)
getSymbols("WILL5000IND",src="FRED")
wilsh <- na.omit(WILL5000IND)
wilsh <- wilsh["2016-01-01/2016-12-31"]
names(wilsh) <- "TR"
y = wilsh
n=length(y)
logret <- diff(log(wilsh))[-1]
```
Now I calculate the empirical VaR with $\alpha = 0.05$
```
alpha <- 0.05
rvec <- as.vector(logret)
quantile(rvec,alpha)
```
With result:
```
5%
-0.01253343
```
Fitting the data in a $t$-distribution and calculate through maximum likelihood method the parameters are:
```
t.fit <- fitdistr(rvec, "t")
round(t.fit$estimate,6)
mu = t.fit$estimate[1]
sd = t.fit$estimate[2]
df = t.fit$estimate[3]
```
Now the value at risk of the $t$-distributed returns is
```
q = qt(alpha,df=df)
varfit = as.numeric(mu + sd *sqrt((n-2)/n)*q)
varfit
```
with result:
```
-0.01183847
```
now if I am so far right, I want to simulate the value at risk for one day ahead so I am doing:
```
rvecs <- rep(0,100000)
library(metRology)
for (i in 1:2) {
rvecs <- rvecs+rt.scaled(100000,
mean=t.fit$estimate[1],
sd=t.fit$estimate[2],
df=t.fit$estimate[3]) }
VaRsim = quantile(rvecs,alpha);VaRsim
```
With result:
```
5%
-0.01659703
```
I don't know if my simulation is correct since the result (from Monte Carlo is not exactly the same). Also I don't know if my methodology is correct.
Any help?
## Answer by Pleb (score 2, accepted)
https://quant.stackexchange.com/a/69945
From your statement,
> now if I am so far right, I want to simulate the value at risk for one day ahead so I am doing:
it looks like you want to forecast Value-at-Risk and not just estimate it from the simulation of a Students t-distribution. If you want to forecast your parametric Monte Carlo VaR, you can follow the framework described below.
In general, I am confused about your for-loop, since it seems redundant. If you want to verify that you have done your calculations correctly and thus re-simulate returns from a scaled $t$-distribution using `rt.scaled`, you need to simulate much more samples, try around 2 million samples.
### Forecasting parametric Monte Carlo VaR:
The idea of forecasting parametric Monte Carlo VaR on the basis of a model $f(\theta)$, lies in simulating a large sample of returns (or log-losses) from the "forecasted" model, $f(\theta_{t\vert t-1})$ and then estimate the $\alpha$-quantile on your simulated data. Here $\theta_{t\vert t-1}$ denotes the conditional parameters for time $t$ given the information available at time $t-1$ and is (generally) the only thing that recursively changes from day to day. A general framework is described below.
#### Framework:
1. Convert your price-series to log-returns (or log-losses).
2. From this, estimate the model parameters $\theta_{t\vert t-1}$ using the information available today (aka. $\mathcal{F}_{t-1}$) via eg. a moving window or an expanding window. Examples are given below:
3. For each day, find the one-day ahead $VaR_{t\vert t-1}(\alpha)$ forecast as the $\alpha$-quantile on the simulated data, ie. $VaR_{t\vert t-1}(\alpha) = F^{-1}_\alpha(\theta_{t \vert t-1})$. In your case, $F^{-1}_\alpha(\mu_{t \vert t-1}, \sigma_{t\vert t-1})$ is the quantile function of a Student's t distribution, where $\mu$ and $\sigma$ denotes respectively the scale and location parameter.
If you want to assess the out-of-sample VaR performance, you can use Failure rates or the unconditional and conditional coverage tests (see for instance the forecasting section of this paper).
### Code illustration for moving and expanding window:
The code below illustrates the moving and expanding window. Within both for-loops we estimate the parameters of the Students' t-distribution, where the first for-loop (the moving window) keeps the window length fixed at 500 and the latter (the expanding window) increases the window length by 1 for each iteration. I encourage you to look it through and get a feel for how it works. I hope it helps.
```
#your own code, extended data from 2016 till 2019
library(quantmod)
getSymbols("WILL5000IND",src="FRED")
wilsh <- na.omit(WILL5000IND)
wilsh <- wilsh["2016-01-01/2019-12-31"]
n=length(wilsh)
logret <- diff(log(wilsh))[-1] * 100
#initialize window length and matrices:
win_length <- 500
est_pars_moving <- matrix(0, ncol = 3, nrow = n - window_length)
est_pars_expanding <- matrix(0, ncol = 3, nrow = n - window_length)
#Moving window estimation:
for(i in (win_length+1):n){
est_pars_moving[(i-win_length), ]<-fitdistr(rvec[(i- win_length):(i-1)], "t")$estimate
}
#Expanding window estimation:
for(i in (win_length+1):n){
est_pars_expanding[(i-win_length), ] <- fitdistr(rvec[1:(i-1)], "t")$estimate
}
```Shown 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.