* * Example 7.3 from pp 295-296 * Value at Risk calculation * open data d-ibmln98.dat data(format=free,org=columns) 1 9190 ibmlog set ibmlog = .01*ibmlog * * GARCH with normal residuals * garch(p=1,q=1,regressors,hseries=h,resids=res) / ibmlog # constant ibmlog{2} * compute r9191=%beta(1)+%beta(2)*ibmlog(9189) compute h9191=%beta(3)+%beta(4)*res(9190)**2+%beta(5)*h(9190) * * %invnormal(.05) and %invnormal(.01) will give the left tail quantiles for the Normal * disp "5% VaR on 10000000" -10000000*(r9191+%invnormal(.05)*sqrt(h9191)) disp "1% VaR on 10000000" -10000000*(r9191+%invnormal(.01)*sqrt(h9191)) * * GARCH with t(5) * garch(p=1,q=1,regressors,distrib=t,shape=5,hseries=h,resids=res) / ibmlog # constant ibmlog{2} compute r9191=%beta(1)+%beta(2)*ibmlog(9189) compute h9191=%beta(3)+%beta(4)*res(9190)**2+%beta(5)*h(9190) * * %invtcdf gives the left tail quantiles for the t. Note that sqrt(h9191) is our * estimate for the variance of the distribution at 9191. Since the t with n * degrees of freedom has a variance of n/(n-2), we have to correct for this to * get a distribution with the correct variance * disp "5% VaR on 10000000" -10000000*(r9191+%invtcdf(.05,5)*sqrt(h9191)/sqrt(5.0/3.0)) disp "1% VaR on 10000000" -10000000*(r9191+%invtcdf(.01,5)*sqrt(h9191)/sqrt(5.0/3.0))