# Fitting distributions to financial data using volatility model to estimate VaR

I want to fit a distribution to my financial data using a volatility model to estimate the VaR. So in case of a normal distribution, this would be very easy, I assume the returns to follow a normal distribution and calculate a volatility forecast for each day, so I have $\sigma_1,\sigma_2,...,\sigma_n,$. I can calculate the VaR via ($\mu$ constant, $z_\alpha$ quantile of standard normal): $VaR_{\alpha ,t}=\mu+\sigma_t z_\alpha$. This is in case, I have losses, so I look at the right tail. So for each day I have a normal density with a constant $\mu$ but a different $\sigma$ corrensponding to the volatility model. Let's assume a very simple volatility model, e.g. (empirical) standard deviation of the last 10 days and the $\mu$ is set to zero. The R code could look like (data):

volatility<-0
quantile<-0
for(i in 11:length(dat)){
volatility[i]<-sd(dat[(i-10):(i-1)])
}

for(i in 1:length(dat)){
quantile[i]<-qnorm(0.975,mean=0,sd=volatility[i])
}
# the first quantile value is the VaR for the 11th date

#plot the volatility
plot(c(1:length(volatility)),volatility,type="l")

lines(quantile,type="l",col="red")


Now, I want to change the volatility model to a more advanced model (EWMA, ARCH, GARCH) and the distribution to a more sophisticated distribution (student, generalized hyperbolic distribution). My main question is now, how can I combine the volatility model and the distribution, since in case e.g. of a Student's-t distribution with parameters $\mu$ (location), $\nu$ (df), $\beta$ (scale) I cannot just plug the $\sigma$ in, because the distribution has no $\sigma$?

One solution I already know is, that I take the variance formula of the corresponding distribution - in case of a Student's-t distribution this would be $\sigma = \beta \frac{v}{v-2}$. I have an estimate for $\sigma$. So for each day I do the ML estimation with a modified log-likelihood where I insert for the scale parameter: $\beta = \hat{\sigma}(\nu-2)/\nu$ and do the estimation.

First of all, is this correct?

I looked at several papers, but I did not understand, how they did this? No matter what volatility model they use, I cannot understand the connection of distribution and volatility model. For example, consider this paper:

On page 50 they are showing the hyperbolical distribution with different volatility models, how did they do this?

Also, I do not understand table 6.2 on page 49: If they have estimated several distributions over the time, they have lots of estimates, but they just show one distribution? I mean, where does it come from? The 3d picture clearly differnt distributions over time, so they have estimated the distribution after 5 days (page 48), but in the table is just one specific distribution with specific parameters? And they give the volatility models in the rows?

A second famous paper is the Technial Document by JPMorgan: RiskMetrics Technical Document - Fourth Edition 1996, December

(since I have not enough reputation I cannot give a second link, you can get the paper by typing "Risk metrics technical document 1996 jp morgan" into google, the first hit is the document with 296 pages)

Especially page 238 is interesting: "According to this model, returns are generated as follows"

$r_t=\sigma_t \xi_t$

$\sigma^2_t=\lambda \sigma^2_{t-1}+(1-\lambda)r_{t-1}^2$

$\xi$ is distributed according to the generalized error distribution. So they do not assume the returns to follow a certain distribution, but they assume the returns condition on the volatility to follow a certain distribution, right?

Now my question is, how can one calculate the VaR in this case? On page 242 they give a short summary, describing the steps. The third step in the most intersting: "Third, we use [...] volatility estimated and the [...] probability distributions ([...] generalized error distribution) evaluated at the parameter estimates to construct VaR forecasts at the 1st and the 99th percentile."

My question is now, how do they do it?

They describe their fitting steps in the steps before, but I am not getting the following point:

Do they fit the distribution to the original return series, calculate the volatility ($\sigma_t$) and then just calculate the VaR with $VaR_t=\sigma_t * q_\alpha$ where $q_\alpha$ is the quantile of the fitted distribution

or

do they fit the distribution to the standardized returns ($\xi_t=r_t/\sigma_t$), calculate the volatility and then just calucate the VaR with $VaR_t=\sigma_t * q_\alpha$ where $q_\alpha$ is now the quantile of the fitted distribution which was fitted using the standardized residuals?

Another question is: Did they set the mean of the return to zero?

My main point is, how to fit a sophisticated distribution to financial data using a volatility forecast for each day, which was generated by EWMA, ARCH or GARCH and how to calculate the VaR for each day over a time horizon and how to implement this. The paper is doing this, but I am simply not getting it. I worked on this for days now and I am really stuck here.

And one other question: If I am doing the way with the modified log-likelihood: This is really challenging in case of a hyperbolic distribution, since the variance is not calculated easily anymore? See wikipedia.

-
Up to where you write "First of all, is this correct?" - I'd say yes with 2 remarks: In the code you use the $0.975$ quantile. This number is positive. But if you use the formula $VaR = \mu + q_z \sigma$ then you need the $0.025$ quantile or in the case of a symmetric distribution you just put a minus sign. Furthermore, what I do is $quantile = q_z \sigma$ and $VaR = -q_z$ and then $VaR$ is a positive number (the risk is positive and the loss is negative). –  Richard Apr 8 '13 at 8:08
When you match an estimate of $\sigma$ and the parameter of the t-distribution then be sure to use it for variance (and not volatility) - or take the square-root of $(\nu-2)/\nu$. –  Richard Apr 8 '13 at 8:09
I think the question is a bit too long - maybe you ca split it up. I hesitate to answer because it is too long (and my answer probably incomplete). –  Richard Apr 8 '13 at 8:11
@Richard first post: Well, actually it is way round: I have the loss distribution already given, so I consider losses. Thats why I look on the 0.975 quantile: In this case, there is a probability of 2.5 %, that the quantile will be exceeded. So if I set mu to zero this would be my VaR. You know what I mean? I have the distribution of the losses, not the distribution of the returns. –  Stat Tistician Apr 8 '13 at 12:17
@Richard The problem is, that everything is connected, so I am even not sure about the fitting of the t distribution, where you said I would be correct. I am not sure, if for my purpose this approach is correct. So that's why I wrote so much, that people know, where I will end up. –  Stat Tistician Apr 8 '13 at 12:19

Hey I fit GARCH models for the estimation of volatility to forecast VaR, I suggest you use the rugarch package in R.

-
this is not what my question was about –  Stat Tistician Apr 6 '13 at 20:32
You have many questions, and I am sure you'll be able to answer most of them on your own if you read about the rugarch package. And mean of the return is not set to 0. –  user1627466 Apr 6 '13 at 20:39
thanks for your answer, but this is not helping me, since fitting Garch is NOT my topic/problem. I can use simpler things like EWMA for the volatility model, this is not the problem. –  Stat Tistician Apr 6 '13 at 20:45

The standard answer to your question would be to do the maximum likelihood estimation. When you say "plug in $\sigma$" you can show that the sample estimate of $\sigma$ is actually the maximum likelihood estimate of $\sigma$ for the normal distribution.

If I can assume that your data are IID then what you do is use your distribution with parameters $\{\theta_1 \ldots \theta_n\}$ to compute $$p(x_1, x_2, \ldots, x_m | \theta_1 \ldots \theta_n) = \prod_j p(x_j | \theta_1 \ldots \theta_n).$$ Here $x_1 \ldots x_m$ are your data points.

Now take logarithms of both sides and you have $$f(\theta_1 \ldots \theta_n) = \sum_j \ln(p(x_j | \theta_1 \ldots \theta_n)).$$

The final step is to maximize the above with respect to $\theta_j$. In many cases you may be able to do this analytically (such as for the normal distribution). If so, you will get a close form equation in terms of your data points for estimating the parameters of your distribution. If not you can plug the above in some numerical optimizer and get the estimates that way. Once you have your estimates you can estimate the VaR by computing the quantiles using your estimated distribution.

If you like Bayesian analysis I believe you get the same answer if you do a Beysian estimation with the conjugate prior (don't quote me on that though, better to check).

As an aside, this is also quite useful for doing robust (ie. outlier resistant) estimates of centre and scale parameters if you stick in some other $f$ that might not correspond to a probability distribution. Tukey functions are a popular choice here.

-