Garch Selection
Posted: Thu Jul 14, 2011 8:03 pm
Hello
I am working on univariate forecasting. in another post, i found program for ARIMA selection, i do it, and then i want to build this ARIMA selection program for GARCH selection. So in defining equation, i changed
from
equation eq_dln{%dep}.ls d(log({%dep})) {%regs} {%arstring} {%mastring}
to
equation eq_dln{%dep}.arch({%archstring}, {%garchstring}) d(log({%dep})) ar(1) ar(2) ar(3) ar(4) ma(1) ma(2) ma(3) ma(4)
(asumpsion: the ARIMA model is ARIMA(4,1,4))
or its the full version of GARCH selection Program
load "D:\PROGRAM\Forecast Saham\Saham Individual\elty_bumi.wf1"
for %index elty bumi
'%eqname = EQ_{%index} 'name of equation object that will be used.
%dep = %index 'dependent variable
%regs = "C " 'independent variables
%maxgarch = "4" 'maximum number of GARCH terms
%maxarch = "4" 'maximum number of ARCH terms
%criterion = "@AIC" 'which criterion to use enter "@AIC" for Akaike, "@schwarz" for Schwarz, @HQ for Hannan-Quinn
!maxgarch = @val(%maxgarch)
!maxarch= @val(%maxarch)
close {%eqname}
'--> Mean Equation
equation dln{%dep}.ls d(log({%dep})) ar(1) ar(2) ar(3) ar(4) ma(1) ma(2) ma(3) ma(4)
'--> heteroskedasticity mean equation
freeze(het_dln{%dep}) dln{%dep}.hettest(type=white)
' 2 - GARCH Estimation
'create table for storing critical values.
table(!maxgarch+2,!maxarch+2) crits_{%dep}
crits_{%dep}(1,1) = "GARCH / ARCH"
crits_{%dep}.setlines(1) +b
crits_{%dep}.setlines(a) +r
'set sample
smpl @all
!mincrit = 1e12 'set the minimum to an artificially large value to begin
'estimate the models
%garchstring = ""
for !i=0 to !maxgarch
'build up string for GARCH terms.
if !i>0 then
%garchstring = %garchstring + " garch(" + @str(!i) + ")"
endif
%archstring = ""
for !j=0 to !maxarch
'build up string for ARCH terms
if !j>0 then
%archstring = %archstring + " arch(" + @str(!j) + ")"
endif
'estimate equation
equation eq_grc_dln{%dep}.arch({%archstring}, {%garchstring}) d(log({%dep})) ar(1) ar(2) ar(3) ar(4) ma(1) ma(2) ma(3) ma(4)
'capture criterion
if @upper(%criterion) = "@AIC" then
' !crit = {%eqname}.@aic
!crit = eq_grc_dln{%dep}.@aic
endif
if @upper(%criterion) = "@SCHWARZ" then
' !crit = {%eqname}.@schwarz
!crit = eq_grc_dln{%dep}.@schwarz
endif
if @upper(%criterion) = "@HQ" then
' !crit = {%eqname}.@hq
!crit = eq_grc_dln{%dep}.@hq
endif
'compare criterion
if !crit < !mincrit then
!mincrit = !crit
!bestGARCH = !i
!bestARCH = !j
%bestGARCHstr = %garchstring 'store the best ar string
%bestARCHstr = %archstring 'store the best ma string
crits_{%dep}.settextcolor(@all) black 'table formatting.
!ii=!i+1
!jj=!j+1
crits_{%dep}.settextcolor(!ii,!jj) red
endif
crits_{%dep}(!i+2,!j+2) = !crit
crits_{%dep}(!i+2,1) = !i
crits_{%dep}(1,!j+2) = !j
next
next
equation eq_grc_dln{%dep}.arch({!bestARCH}, {%!bestGARCH}) d(log({%dep})) ar(1) ar(2) ar(3) ar(4) ma(1) ma(2) ma(3) ma(4)
' 3 - forecast
eq_grc_dln{%dep}.fit {%dep}_f
next
but it didn't worked up. table for criterion model showed the same number for all of possibility model. is there anything wrong?
Thank you.
I am working on univariate forecasting. in another post, i found program for ARIMA selection, i do it, and then i want to build this ARIMA selection program for GARCH selection. So in defining equation, i changed
from
equation eq_dln{%dep}.ls d(log({%dep})) {%regs} {%arstring} {%mastring}
to
equation eq_dln{%dep}.arch({%archstring}, {%garchstring}) d(log({%dep})) ar(1) ar(2) ar(3) ar(4) ma(1) ma(2) ma(3) ma(4)
(asumpsion: the ARIMA model is ARIMA(4,1,4))
or its the full version of GARCH selection Program
load "D:\PROGRAM\Forecast Saham\Saham Individual\elty_bumi.wf1"
for %index elty bumi
'%eqname = EQ_{%index} 'name of equation object that will be used.
%dep = %index 'dependent variable
%regs = "C " 'independent variables
%maxgarch = "4" 'maximum number of GARCH terms
%maxarch = "4" 'maximum number of ARCH terms
%criterion = "@AIC" 'which criterion to use enter "@AIC" for Akaike, "@schwarz" for Schwarz, @HQ for Hannan-Quinn
!maxgarch = @val(%maxgarch)
!maxarch= @val(%maxarch)
close {%eqname}
'--> Mean Equation
equation dln{%dep}.ls d(log({%dep})) ar(1) ar(2) ar(3) ar(4) ma(1) ma(2) ma(3) ma(4)
'--> heteroskedasticity mean equation
freeze(het_dln{%dep}) dln{%dep}.hettest(type=white)
' 2 - GARCH Estimation
'create table for storing critical values.
table(!maxgarch+2,!maxarch+2) crits_{%dep}
crits_{%dep}(1,1) = "GARCH / ARCH"
crits_{%dep}.setlines(1) +b
crits_{%dep}.setlines(a) +r
'set sample
smpl @all
!mincrit = 1e12 'set the minimum to an artificially large value to begin
'estimate the models
%garchstring = ""
for !i=0 to !maxgarch
'build up string for GARCH terms.
if !i>0 then
%garchstring = %garchstring + " garch(" + @str(!i) + ")"
endif
%archstring = ""
for !j=0 to !maxarch
'build up string for ARCH terms
if !j>0 then
%archstring = %archstring + " arch(" + @str(!j) + ")"
endif
'estimate equation
equation eq_grc_dln{%dep}.arch({%archstring}, {%garchstring}) d(log({%dep})) ar(1) ar(2) ar(3) ar(4) ma(1) ma(2) ma(3) ma(4)
'capture criterion
if @upper(%criterion) = "@AIC" then
' !crit = {%eqname}.@aic
!crit = eq_grc_dln{%dep}.@aic
endif
if @upper(%criterion) = "@SCHWARZ" then
' !crit = {%eqname}.@schwarz
!crit = eq_grc_dln{%dep}.@schwarz
endif
if @upper(%criterion) = "@HQ" then
' !crit = {%eqname}.@hq
!crit = eq_grc_dln{%dep}.@hq
endif
'compare criterion
if !crit < !mincrit then
!mincrit = !crit
!bestGARCH = !i
!bestARCH = !j
%bestGARCHstr = %garchstring 'store the best ar string
%bestARCHstr = %archstring 'store the best ma string
crits_{%dep}.settextcolor(@all) black 'table formatting.
!ii=!i+1
!jj=!j+1
crits_{%dep}.settextcolor(!ii,!jj) red
endif
crits_{%dep}(!i+2,!j+2) = !crit
crits_{%dep}(!i+2,1) = !i
crits_{%dep}(1,!j+2) = !j
next
next
equation eq_grc_dln{%dep}.arch({!bestARCH}, {%!bestGARCH}) d(log({%dep})) ar(1) ar(2) ar(3) ar(4) ma(1) ma(2) ma(3) ma(4)
' 3 - forecast
eq_grc_dln{%dep}.fit {%dep}_f
next
but it didn't worked up. table for criterion model showed the same number for all of possibility model. is there anything wrong?
Thank you.