rolling out of sample forecasts (ARMA+GARCH)

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.

rolling out of sample forecasts (ARMA+GARCH)

Postby potiv » Tue Nov 08, 2011 6:54 pm

Dear Tom,
I wonder if I could ask for your kind help to double check whether the code below is ok. I need to forecast the rolling out of sample mean and variance of a number of series and its really crucial that I get the 'time subscripts' right. The model is a relatively simple ARMA+GARCH. My big worry is that I might inadvertently put, say, the predicted variance for period t+1 into period t, or something like that. Many thanks in advance for your help (as well as for all the help offered in the past!). :) :D
Best regards,
Valerio

Code: Select all
*
*******************************************************************
**************   dep is the dependent variable ********************
*******************************************************************
*
source bjautofit2.src
source garchfore.src
dec vec[series] means(nr) vars(nr) sr(nr)
com window = 60
infobox(action=define,progress,lower=1,upper=nr)
do i=1,nr
{
  clear dep mean var
  set dep = y(i)
  inquire(series=dep) start end
  do time = start+window,end-1
  {
    @bjautofit2(diffs=0,noprint,constant,pmax=5,qmax=5,crit=aic) dep time-window time
      com ar = %%autop, ma = %%autoq
     equation armagarch dep ar ma
      garch(p=1,q=1,print,model=armagarch,hseries=ht,resids=at,PMETHOD=SIMPLEX,PITERS=20) time-window+fix(%max(ar,ma)) time dep
     if %converged==1
     {
      @garchfore(steps=1) ht at
      uforecast(equation=armagarch,steps=1) m
      com mean(time+1) = m(time+1)
      com var(time+1) = ht(time+1)
     }
     else
     {
     com mean(time+1) = %na
     com var(time+1) = %na
     }
   }
  end do time
  set means(i) start+window end = mean
  set vars(i) start+window end = var
  set sr(i) start+window end = means(i)/sqrt(vars(i))
  infobox(current=i)
dis 'Portfolio nr: ' i
}
end do i
infobox(action=remove)
*
potiv
 
Posts: 7
Joined: Fri Sep 04, 2009 6:26 am

Re: rolling out of sample forecasts (ARMA+GARCH)

Postby TomDoan » Thu Nov 10, 2011 1:00 pm

That looks correct.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: rolling out of sample forecasts (ARMA+GARCH)

Postby potiv » Tue Nov 22, 2011 5:43 pm

many thanks! :D
Valerio
potiv
 
Posts: 7
Joined: Fri Sep 04, 2009 6:26 am


Return to Help With Programming

Who is online

Users browsing this forum: No registered users and 1 guest