GARCH models on subsamples

Discussions of ARCH, GARCH, and related models

GARCH models on subsamples

Postby filonat » Thu Jan 19, 2012 5:14 am

Hi, I'm running a GJR(1,1)-MA(1)-m with returns distributed as a student's t.
It works fine on the whole sample, but if I try to run it on subsamples it gives this (same result if I impose the sample with "sample start end" or directly inside the garch):

GARCH Model - Estimation by BFGS
Convergence in 1 Iterations. Final criterion was +NAN <= 0.0000100
Daily(5) Data From 1990:02:16 To 2000:02:18
Usable Observations 2610
Total Observations 2611 Skipped/Missing 1
Log Likelihood NA

Variable Coeff Std Error T-Stat Signif
*******************************************************************************
1. Constant -NAN 0.000000 0.00000 0.00000000
2. GARCH-V -NAN 0.000000 0.00000 0.00000000
3. Mvg Avge{1} -NAN 0.000000 0.00000 0.00000000
4. C -NAN 0.000000 0.00000 0.00000000
5. A -NAN 0.000000 0.00000 0.00000000
6. B -NAN 0.000000 0.00000 0.00000000
7. D -NAN 0.000000 0.00000 0.00000000
8. Shape -NAN 0.000000 0.00000 0.00000000


I did the arch test on the whole sample and on the subsample, they say there are arch effects in both case.


My variable is rend (daily return on the FTSE100 index); the model is this one:

garch(p=1,q=1, resids=e, asymmetric, distrib=t, method=bfgs, regressors, hseries=h) / rend
# constant %garchv %mvgavge{1}


what's wrong in that?
thanks!
filonat
 
Posts: 7
Joined: Mon Jan 02, 2012 11:38 am

Re: GARCH models on subsamples

Postby filonat » Thu Jan 19, 2012 5:18 am

the whole sample is 22 years of daily returns, my subsample is just 10 years. Can't Rats handle this data reduction for garch models?
filonat
 
Posts: 7
Joined: Mon Jan 02, 2012 11:38 am

Re: GARCH models on subsamples

Postby TomDoan » Thu Jan 19, 2012 12:28 pm

No reason that I can think of. That's a different data set than you were using before. Could you post that so I can take a look?
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: GARCH models on subsamples

Postby filonat » Wed Jan 25, 2012 10:18 am

Here is the code:

Code: Select all
calendar(m) 1980:1
all 2011:12
open data 'd:\dati\Ricerca\Petrolio\Risk_appetite\monthly time series RND\dati_sp500.xls'
data(org=obs, format=excel)

set rend = sp_500/sp_500{1}-1
table /

com startm = 1990:1, endm = 1999:12
com numdens = 12

do count = 1, numdens
@archtest rend startm endm+count

garch(p=1,q=1, resids=e, asymmetric, method=bfgs, regressors, hseries=h) $
startm endm+count rend
# constant %garchv %mvgavge{1}


com mu=%BETA(1), lambda=%BETA(2), theta=%BETA(3), $
omega=%BETA(4), alfa=%beta(5), beta=%BETA(6), alfamin=%BETA(7)

com persistence = alfa+0.5*alfamin+beta
com asymm = (alfa+alfamin)/alfa
dis persistence asymm

compute gstart=%regstart(), gend=%regend()

set z gstart gend = e/sqrt(h)

set  h gend+1 gend+1 = %if(e(gend)>0, $
omega + alfa*e(gend)**2 + beta*h(gend), $
omega + alfa*e(gend)**2 + alfamin*e(gend)**2 + beta*h(gend))
set mut gend+1 gend+1 = mu

com span=1
com ndraws=10000

dec vect pricesim(ndraws)

do draws = 1, ndraws
      set z gend+1 gend+1 = ((-1)^(draws+1))**%ran(1.0)
      set e gend+1 gend+1 = z(gend+1)*sqrt(h(gend+1))
      set rend gend+1 gend+1 = mu + e(gend+1)
      set prices gend+1 gend+1 = sp_500(endm+count)*exp(rend(gend+1))
      sstats gend+1 gend+1 prices>>pricesim(draws)
end do draws

set pr 1 ndraws = pricesim(t)

SOURCE(NOECHO) DENSITY.SRC
@DENSITY(minval=%if(sp_500(endm+count)-900<0,0,sp_500(endm+count)-900), $
maxval=sp_500(endm+count)+900, nrval=181) pr 1 ndraws $
%s("XDENS"+%l(count)) %s("YDENS"+%l(count))
com winwidth = %s("XDENS"+%l(count))(2) - %s("XDENS"+%l(count))(1)
set %s("ydens_w"+%l(count)) = %s("YDENS"+%l(count))*winwidth
end do


I'm trying to loop, with monthly data, the one-step-ahead simulation of risk-neutral density of S&P500 using a GJR(1,1)-MA(1),M (i.e., 12 densities, from 2000:2 to 2001:1). I understand that sometimes the arch test on a 10 to 20 years-long time series rejects the arch effects, but let's suppose I want to use my garch parameters even if some some of those is not really significant. Most of the time, even if the arch test says no arch effect, the garch optimization converge.

I really do not understand why the same garch, for the same sample, with the same optimization method, sometimes converge and sometimes no.
If I run separately my garch models and my density estimation all works fine, but when I add a loop to use different samples in order to produce more than one density, no convergence of the garch algorithm (and the loop ends with no result).

How can I fix this problem? I attach my dataset,
thank you very much

filippo
Attachments
dati_sp500.xls
(28.5 KiB) Downloaded 20 times
filonat
 
Posts: 7
Joined: Mon Jan 02, 2012 11:38 am

Re: GARCH models on subsamples

Postby TomDoan » Wed Jan 25, 2012 10:54 am

The first of these lines from your draw loop is overwriting your data. Choose a different name in this and the next line.

set rend gend+1 gend+1 = mu + e(gend+1)
set prices gend+1 gend+1 = sp_500(endm+count)*exp(rend(gend+1))
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: GARCH models on subsamples

Postby filonat » Wed Jan 25, 2012 10:55 am

Hi Toam, yes you're right,I tried to simplify but I made a mistake, please replace the whole code with the following one (it works). the dataset is the same.


Code: Select all
calendar(m) 1980:1
all 2011:12
open data 'd:\dati\Ricerca\Petrolio\Risk_appetite\monthly time series RND\dati_sp500.xls'
data(org=obs, format=excel)
set rend = sp_500/sp_500{1}-1
table /

@archtest rend

garch(p=1,q=1, resids=e, asymmetric, method=bfgs, regressors, hseries=h) / rend
# constant %garchv %mvgavge{1}

com mu=%BETA(1), lambda=%BETA(2), theta=%BETA(3), $
omega=%BETA(4), alfa=%beta(5), beta=%BETA(6), alfamin=%BETA(7)

com persistence = alfa+0.5*alfamin+beta
com asymm = (alfa+alfamin)/alfa
dis persistence asymm

compute gstart=%regstart(), gend=%regend()

set z gstart gend = e/sqrt(h)

set  h gend+1 gend+1 = %if(e(gend)>0, omega + alfa*e(gend)**2 + beta*h(gend), omega + alfa*e(gend)**2 + alfamin*e(gend)**2 + beta*h(gend))
set mut gend+1 gend+1 = mu


com span=1
com ndraws=100000

dec vect sumret(ndraws)

do draws = 1, ndraws
   do spans = 1, span
      set z gend+spans gend+spans = ((-1)^(draws+1))*%ran(1.0)
      set e gend+spans gend+spans = z(gend+spans)*sqrt(h(gend+spans))
      set rend gend+spans gend+spans = mu + e(gend+spans)
      set  h gend+spans+1 gend+spans+1 = %if(e(gend+spans)>0, omega $
      + alfa*e(gend+spans)**2 + beta*h(gend+spans), omega + alfa*e(gend+spans)**2 $
      + alfamin*e(gend+spans)**2 + beta*h(gend+spans))
      *set mut gend+spans+1 gend+spans+1 = mu + lambda*sqrt(h(gend+spans+1))
      end do spans
   accumulate rend gend+1 gend+span rendsum
   sstats gend+span gend+span rendsum>>sumret(draws)
end do draws

dec vect prices(ndraws)
dec vect priceok(ndraws)
com prices =sp_500(gend)*%exp(sumret)



do i=1,ndraws
   com priceok(i) = %if(prices(i)<0.1, %NA, prices(i))
end do i

set pr 1 ndraws = prices(t)

SOURCE(NOECHO) DENSITY.SRC
@DENSITY(minval=%if(sp_500(gend)-500<0,0,sp_500(gend)-500), $
maxval=sp_500(gend)+500, nrval=181) pr 1 ndraws xdens ydens
com winwidth = xdens(2) - xdens(1)
set ydens_w = ydens*winwidth
SCATTER(STYLE=LINES) 1
# XDENS YDENS_w

copy(FORMAT=XLS, org=columns) / xdens ydens_W



here I'd like to loop by changing the sample, that's what I tried to do in the code I attached before

Fil
filonat
 
Posts: 7
Joined: Mon Jan 02, 2012 11:38 am

Re: GARCH models on subsamples

Postby TomDoan » Wed Jan 25, 2012 3:26 pm

There's a discusion on pp UG-344 and UG-345 about estimating GARCH models with rolling samples. You have a relatively short sample and the first half of it is dominated by the 1987 crash. A vanilla GARCH model seems to estimate fine with rolling samples starting in 2000 as you were doing, but once you add the variance and asymmetry, the estimation needs quite a bit more TLC to converge. Starting with the full sample and working backwards, while feeding in guess values from the longer sample, seems to work.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm


Return to ARCH and GARCH Models

Who is online

Users browsing this forum: No registered users and 2 guests