Quantitative finance collector
C++ Matlab VBA/Excel Java Mathematica R/Splus Net Code Site Other
Feb 25

VaR Backtesting

Posted by abiao at 08:49 | Code » Other | Comments(20) | Reads(32305)
A follow-up of my previous post Value at Risk xls, I was asked why not & how to add a VaR backtesting module in that excel file, well, it is straightforward in principle to do that but since we have to calculate daily VaR for multiple periods in order to do backtesting, I simply didn't add that in an excel for speed reason.

The Backtesting framework developed by the Basel committee is the main methodology to judge the performance of VaR model, it typically consists of a periodic comparison of the portfolio’s or asset’s daily VaR values with the subsequent daily profit and loss (P&L). Obviously, the ideal model should generate the times of VaR exceeding P&L equal to (1-alpha) multiplied by time periods for backtesting. For a single equity case it is obvious what we need to do is comparing daily VaR results with daily return; but for a portfolio we have to be careful with the trading positions.

Basel committee (1996) introduces a three-zone approach, where the green zone means the possibility of erroneously accepting an inaccurate model is low; yellow zone is risk manager should be careful to check the model before take action; red zone means the probability of erroneously rejecting an accurate model is remote. For example, the backtesting three zones boundaries for a sample of 250 observations, source from Basel committee, 1996 look like
var three zone table
Backtesting results can therefore be judged by counting the number of exceptions and seeing intuitively which colour zone it falls into.

Alternatively you can rely on some statistical testing, for instance, the exception testing by Kupiec (1995).

Your final VaR backtesting results will look similar to
var backtesting graph
var backtesting table
by which you are able to tell the performance of your VaR model.

certainly there isn't only one way for VaR backtesting, the above-mentioned one is an example.

pigI really need VBA code of backtesting. Could you please upload one if possible. Thx
I'm looking for a VBA program to do VaR backtesting. Hope you can give us a good example. Thank u so much!
Hi, abiao! I download your ValueatRisk file. It's absolutely brilliant! I'm wondering why dont u add a backtesting or stress testing in this file? if so, this file must be perfect!  looking forward ur backtesting code, Cheers!
Backtesting takes longer time to compute than for VaR, I don't recommend to do that in VBA, much less efficient than in Matlab, R, etc.
Hi, I would like to know which are the inputs calculating the VaR Backtesting. I work with index prices. so, I  will use the daily log-returns [ln(a2/a1)] as one vector and the other vector will be the VaR calculated as the standard deviation of each day multiplied i.e. for the 5% by -1.645????
for a single index, yes, it is that way for parametric method.
thanks for your immediate responce. however, the results I get is both for Kupiec and Conditional coverage 0 and only the independence test gives me 0.2945. (my log-returns are all between -4.987 and 4.346 while my VaR is between -3.788 and -0.657). I have a range of 10000 observations and I use the last 2000 for backtest.
Could you give me an advise on this?
I can't tell based on the info you gave, as it looks like your VaR number is reasonable. May be your test is wrong... Plot out the graph and roughly count the exceeding numbers to check roughly.
if i have 1 day VaR for 500 daily observationof a portfolio and i want to do backtesting. How can this be possible. How can i get the exceeding values of 500 returns while i have just 1 portfolio VaR ?
hope u can help me as soo as possible
downloading an .xls example would be perfect.
You are supposed to calculate VaR values for each of the 500 days. Then compare your VaR values with the 500 "true " return of your hypothetical portfolio. It is not possible todo backtest with 1 VaR.
But if i am applying a historical simulation or monte carlo, i do compute var through computing the percentile of the whole 500 days P/L.. how can i compute the VaR for one single day of the whole portfolio.

Also, what if i am applying the variance-covariance method, how can this be possible?

please help.. i appreciate it a lot
when you estimate 1-day VaR, you basically calculate the maximum possible loss of your portfolio one  day later. so each day you should have a VaR value, you are only using the past 500 days to compute this VaR value, that's it. When you do backtesting, you compare VaRs and returns to see if your VaR model is good enough or not. You can use 200 days' VaR or 250 days, or whatever days, but for each day's VaR, you use the past 500 observations of that day in you example. It has nth to do with VaR estimation method.
Can you recommend any article that include the process by which i can compute the VaR values on daily basis   and implement Backtesting method ?
you can search in google RiskMetric technical document for detail, or the book Value at Risk, 3rd Ed.: The New Benchmark for Managing Financial Risk by Philippe Jorio is agood one.
Pages: 1/2 First page 1 2 Next page Final page
Add a comment
Enable HTML
Enable UBB
Enable Emots
Nickname   Password   Optional
Site URI   Email   [Register]