I have the following AR(1)-GARCH(1,1) model for the daily returns $r_t$ $$r_t=\theta r_{t-1}+u_t\;\;\;u_t=\sigma_t\epsilon_t\;\;\;\sigma_t^2=\omega+\alpha u_{t-1}^2+\beta \sigma_{t-1}^2 $$ where $-1<\theta<1$, $\theta \neq0$, $\omega>0$, $\alpha,\beta \in(0,1)$, and $\alpha+\beta<1$. I need to calculate the 99% 2-day VaR and expected shortfall on a long position and on a short position at time $t$. I have no idea how to compute this. Can someone please show me or at least provide a reference that has good examples?


1 Answer 1


This is best done through simulation. See my MATLAB code example and explanation below:

%% Get S&P 500 price series
d=fetch(yahoo,'^GSPC','Adj Close','1-jan-2014','30-dec-2014');
n = 1; % # of shares
p = d(end:-1:1,2); % share price, the dates are backwards
PV0 = n*p(end); % portfolio value today
r=price2ret(p,[],'Continuous'); % get the continous compounding returns
Mdl = arima('ARLags',1,'Variance',garch(1,1),'Constant',0);
fit = estimate(Mdl,r) % fit the AR(1)-GARCH(1,1)

[E0,V0] = infer(fit,r); % get the estimated errors and variances
%% Simulate periods ahead
[Y] = simulate(fit,2,'Y0',r,'E0',E0,'V0',V0, 'NumPaths',1e5);
ret = sum(Y); % compund the return

title 'P&L distribution'

ret2d = prctile(ret,0.01); % get the 99% lowest return

VaR = PV0*(exp(ret2d)-1);

fprintf('Today portfolio value: %f\n2-days ahead 99%% VaR: %f\n',PV0,VaR);


    ARIMA(1,0,0) Model:
    Conditional Probability Distribution: Gaussian

                                  Standard          t     
     Parameter       Value          Error       Statistic 
    -----------   -----------   ------------   -----------
     Constant              0         Fixed          Fixed
        AR{1}      -0.020272     0.0697731      -0.290541

    GARCH(1,1) Conditional Variance Model:
    Conditional Probability Distribution: Gaussian

                                  Standard          t     
     Parameter       Value          Error       Statistic 
    -----------   -----------   ------------   -----------
     Constant    7.43521e-06   2.14546e-06        3.46556
     GARCH{1}       0.653488      0.126818        5.15295
      ARCH{1}       0.206016     0.0881823        2.33626

fit = 

    ARIMA(1,0,0) Model:
    Distribution: Name = 'Gaussian'
               P: 1
               D: 0
               Q: 0
        Constant: 0
              AR: {-0.020272} at Lags [1]
             SAR: {}
              MA: {}
             SMA: {}
        Variance: [GARCH(1,1) Model]

ans = 

    GARCH(1,1) Conditional Variance Model:
    Distribution: Name = 'Gaussian'
               P: 1
               Q: 1
        Constant: 7.43521e-06
           GARCH: {0.653488} at Lags [1]
            ARCH: {0.206016} at Lags [1]
Today portfolio value: 2090.570000
2-days ahead 99% VaR: -79.986280

enter image description here

For a portfolio consisting of one share of S&P 500 index, I got the current value of \$2091, and 2-day VaR at 99% is \$80.

I also plotted the P&L distribution with Normal fit, so you can see that the normal distribution is not a very good fit. That's why you have to simulate when using GARCH.

You can also look at MATLAB's own GARCH example here.

The idea is that you fit AR(1)-GARCH(1,1) to the returns. Then you Monte-Carlo simulate the returns two days ahead. Then you compound two days of returns in each path, and find 0.01 percentile. This is how much or more you'll lose at 99% confidence in terms of returns, and in terms of dollars it's a simple arithmetic using the current portfolio value.

You can find worked out examples in this book: Carol Alexander, Market Risk Analysis, Volume IV, Value at Risk Models, February 2009

  • $\begingroup$ I was hoping for a hand derivation of the formulas, sorry I should have been more clear. In any case it looks like you've only computed the 2-day VaR on a long position. Any ideas about the short position? What about expected shortfall? $\endgroup$
    – Wintermute
    Commented Dec 31, 2014 at 18:30
  • $\begingroup$ @mtiano, is this a home work? Nobody hand-derives n-day GARCH VaRs in practice. The short position is the same as long, except that the sign change. The CVaR is a trivial tweak of the code: at the end you compute the mean of the tail. If this is a home work, you should tag it with self-study, and show your work. $\endgroup$
    – Aksakal
    Commented Dec 31, 2014 at 18:44
  • $\begingroup$ I reading Statistical Models and Methods for Financial Markets for work. In the book the author gives the formulas for VaR and ES using a AR(1)-GARCH(1,1) model. I'm trying to understand where they come from. $\endgroup$
    – Wintermute
    Commented Dec 31, 2014 at 19:07
  • 2
    $\begingroup$ You can try to hand-derive them, it won't work, of course. All you need is to roll two days ahead from today using the equations you gave. You'll end up with product of gaussians, and there's no analytic expression for it. That's why GARCH is always simulated, especially for n-day forecasts. $\endgroup$
    – Aksakal
    Commented Dec 31, 2014 at 19:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.