* * EGARCHBOOTSTRAP.RPF * * Example of bootstrapping an EGARCH model (for forecasting * variance out-of-sample) * open data garch.asc data(format=free,org=columns) 1 1867 bp cd dm jy sf * set dlogdm = 100*log(dm/dm{1}) garch(p=1,q=1,exp,asymmetric,hseries=h) / dlogdm * * Pull out the coefficients for the EGARCH process * compute c=%beta(2),a=%beta(3),b=%beta(4),d=%beta(5) compute gstart=%regstart(),gend=%regend() * set stdu = %resids/sqrt(h) * compute ndraws=10000 compute nsteps=50 * compute bstart=gend+1,bend=gend+nsteps set h bstart bend = %na dec series[vect] hdraws gset hdraws bstart bend = %zeros(ndraws,1) do draw=1,ndraws boot entries bstart bend gstart gend * * This is way the asymmetric EGARCH instruction is parameterized in * RATS. Nelson's original formulation is equivalent, but the c, a and * d coefficients have different meanings. Because the recursion uses * the standardized residuals only, there is no need to multiply up * the bootstrapped standardized residuals by the standard deviation * unless you need bootstrapped data and not just variances. * set stdu bstart bend = h=exp(c+b*log(h{1})+a*abs(stdu{1})+d*%max(stdu{1},0.0)),stdu(entries(t)) do t=bstart,bend compute hdraws(t)(draw)=h(t) end do t end do draw * set lower bstart bend = %fractiles(hdraws(t),||.05||)(1) set upper bstart bend = %fractiles(hdraws(t),||.95||)(1) set median bstart bend = %fractiles(hdraws(t),||.50||)(1) * graph(header="Bootstrapped Forecasts for EGARCH model") 4 # h 1800 1867 # median 1868 1868+nsteps-1 # lower 1868 1868+nsteps-1 3 # upper 1868 1868+nsteps-1 3