Automatic ARMA selection
Moderators: EViews Gareth, EViews Moderator
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13330
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Automatic ARMA selection
Hi,
can we find the best EGARCH model after we find the best ARMA model by the above program?
can we find the best EGARCH model after we find the best ARMA model by the above program?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13330
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Automatic ARMA selection
It is not written into the program, no, but there is no theoretical reason why you could not add that feature.
Follow us on Twitter @IHSEViews
Re: Automatic ARMA selection
Thank you,
can you please show me a way to correct that syntax for ARCH/GARCH?
can you please show me a way to correct that syntax for ARCH/GARCH?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13330
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Automatic ARMA selection
The syntax for ARCH estimation can be found in the Object Reference, but in general it is:
where p is the ARCH order and q is the GARCH order.
Code: Select all
equation.arch(p,q) spec
where p is the ARCH order and q is the GARCH order.
Follow us on Twitter @IHSEViews
Re: Automatic ARMA selection
'Program that calculates the "best" EGARCH specification
%eqname = "EQ02" 'name of equation object that will be used.
%maxARCH = "9" 'maximum number of ARCH terms
%maxGARCH = "9" 'maximum number of GARCH terms
%dep = "dow1" 'dependent variable
%regs = "C ar(1) ma(1)" 'independent variables
%criterion = "@AIC" 'which criterion to use enter "@AIC" for Akaike, "@schwarz" for Schwarz, and @HQ for Hannan-Quinn
!maxARCH = @val(%maxARCH)
!maxGARCH = @val(%maxGARCH)
close {%eqname}
'create table for storing critical values.
%matname = "critsegarch"
if @isobject(%matname) then
%matname = "__critsegarch"
if @isobject(%matname) then
delete {%matname}
endif
endif
table(!maxARCH +2,!maxGARCH+2) {%matname}
{%matname}(1,1) = " ARCH / GARCH"
{%matname}.setlines(1) +b
{%matname}.setlines(a) +r
'set sample
smpl @first+!maxARCH @last
!mincrit = 1e12 'set the minimum to an artificially large value to begin
'estimate the models
%Archstring = ""
for !i=1 to !maxARCH
'build up string for ARCH terms.
if !i>0 then
%ARCHstring = %ARCHstring + " ARCH(" + @str(!i) + ")"
endif
%GARCHstring = ""
for !j=0 to !maxGARCH
'build up string for GARCH terms
if !j>0 then
%GARCHstring = %GARCHstring + " GARCH(" + @str(!j) + ")"
endif
'estimate equation
equation {%eqname}.ARCH({%ARCHstring}, {%GARCHstring}, egarch) {%dep} {%regs}
'capture criterion
if %criterion = "@AIC" then
!crit = {%eqname}.@aic
endif
if %criterion = "@SCHWARZ" then
!crit = {%eqname}.@schwarz
endif
if %criterion = "@HQ" then
!crit = {%eqname}.@hq
endif
'compare criterion
if !crit < !mincrit then
!mincrit = !crit
!bestARCH = !i
!bestGARCH = !j
%bestARCHstr = %ARCHstring 'store the best ARCHstring
%bestGARCHstr = %GARCHstring 'store the best GARCHstring
{%matname}.settextcolor(@all) black 'table formatting.
!ii=!i+2
!jj=!j+2
{%matname}.settextcolor(!ii,!jj) red
endif
{%matname}(!i+2,!j+2) = !crit
{%matname}(!i+2,1) = !i
{%matname}(1,!j+2) = !j
next
next
equation {%eqname}.ARCH({%bestARCHstring}, {%bestGARCHstring},egarch) {%dep} {%regs}
show {%eqname}
show {%matname}
Follow us on Twitter @IHSEViews
%eqname = "EQ02" 'name of equation object that will be used.
%maxARCH = "9" 'maximum number of ARCH terms
%maxGARCH = "9" 'maximum number of GARCH terms
%dep = "dow1" 'dependent variable
%regs = "C ar(1) ma(1)" 'independent variables
%criterion = "@AIC" 'which criterion to use enter "@AIC" for Akaike, "@schwarz" for Schwarz, and @HQ for Hannan-Quinn
!maxARCH = @val(%maxARCH)
!maxGARCH = @val(%maxGARCH)
close {%eqname}
'create table for storing critical values.
%matname = "critsegarch"
if @isobject(%matname) then
%matname = "__critsegarch"
if @isobject(%matname) then
delete {%matname}
endif
endif
table(!maxARCH +2,!maxGARCH+2) {%matname}
{%matname}(1,1) = " ARCH / GARCH"
{%matname}.setlines(1) +b
{%matname}.setlines(a) +r
'set sample
smpl @first+!maxARCH @last
!mincrit = 1e12 'set the minimum to an artificially large value to begin
'estimate the models
%Archstring = ""
for !i=1 to !maxARCH
'build up string for ARCH terms.
if !i>0 then
%ARCHstring = %ARCHstring + " ARCH(" + @str(!i) + ")"
endif
%GARCHstring = ""
for !j=0 to !maxGARCH
'build up string for GARCH terms
if !j>0 then
%GARCHstring = %GARCHstring + " GARCH(" + @str(!j) + ")"
endif
'estimate equation
equation {%eqname}.ARCH({%ARCHstring}, {%GARCHstring}, egarch) {%dep} {%regs}
'capture criterion
if %criterion = "@AIC" then
!crit = {%eqname}.@aic
endif
if %criterion = "@SCHWARZ" then
!crit = {%eqname}.@schwarz
endif
if %criterion = "@HQ" then
!crit = {%eqname}.@hq
endif
'compare criterion
if !crit < !mincrit then
!mincrit = !crit
!bestARCH = !i
!bestGARCH = !j
%bestARCHstr = %ARCHstring 'store the best ARCHstring
%bestGARCHstr = %GARCHstring 'store the best GARCHstring
{%matname}.settextcolor(@all) black 'table formatting.
!ii=!i+2
!jj=!j+2
{%matname}.settextcolor(!ii,!jj) red
endif
{%matname}(!i+2,!j+2) = !crit
{%matname}(!i+2,1) = !i
{%matname}(1,!j+2) = !j
next
next
equation {%eqname}.ARCH({%bestARCHstring}, {%bestGARCHstring},egarch) {%dep} {%regs}
show {%eqname}
show {%matname}
Follow us on Twitter @IHSEViews
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13330
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Automatic ARMA selection
Think about what you are doing.
The syntax for ARCH, as you pointed out is:
equation.ARCH(1,2, EGARCH)
What syntax are you using?
The syntax for ARCH, as you pointed out is:
equation.ARCH(1,2, EGARCH)
What syntax are you using?
Follow us on Twitter @IHSEViews
Re: Automatic ARMA selection
Dear Gareth,
I donot have any programing experience,
I just try to use my logic and adopt your program, so I think the syntax is presented at the line “ ‘estimate equation” (?). If so, it should be like this,
equation {%eqname}.ARCH({%ARCHstring}, {%GARCHstring}, egarch) {%dep} {%regs}
so I think each time program should try the following EGARCH models:
ARCH(1,1,egarch) dow1 c
ARCH(2,1,egarch) dow1 c
ARCH(3,1,egarch) dow1 c
...
...
...
ARCH(1,2,egarch) dow1 c
ARCH(1,3,egarch) dow1 c
...
...
...
And record the resulting AIC to the resulting table.
I think this is also what the ARMA program does.
But I see each time program runs ARMA(1,1)EGARCH(1,1,1) and record the AIC’s to the table instead of changing the ARCH and GARCH terms,
Or indeed it changes bur record always the first ones AIC.
Should I rite something else or which part of the program should I change please?
Thank you very much
I donot have any programing experience,
I just try to use my logic and adopt your program, so I think the syntax is presented at the line “ ‘estimate equation” (?). If so, it should be like this,
equation {%eqname}.ARCH({%ARCHstring}, {%GARCHstring}, egarch) {%dep} {%regs}
so I think each time program should try the following EGARCH models:
ARCH(1,1,egarch) dow1 c
ARCH(2,1,egarch) dow1 c
ARCH(3,1,egarch) dow1 c
...
...
...
ARCH(1,2,egarch) dow1 c
ARCH(1,3,egarch) dow1 c
...
...
...
And record the resulting AIC to the resulting table.
I think this is also what the ARMA program does.
But I see each time program runs ARMA(1,1)EGARCH(1,1,1) and record the AIC’s to the table instead of changing the ARCH and GARCH terms,
Or indeed it changes bur record always the first ones AIC.
Should I rite something else or which part of the program should I change please?
Thank you very much
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13330
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Automatic ARMA selection
You are correct - you want to generate:
And you do that by building %archstring and %garchstring. However, currently you have:
and:
Which means that you are in fact building up this:
Which is why you're getting the errors.
So you need to change your specification of %archstring and %garchstring so that they create the correct syntax.
Code: Select all
ARCH(1,1,egarch) dow1 c
ARCH(2,1,egarch) dow1 c
ARCH(3,1,egarch) dow1 c
...
...
...
ARCH(1,2,egarch) dow1 c
ARCH(1,3,egarch) dow1 c
And you do that by building %archstring and %garchstring. However, currently you have:
Code: Select all
%ARCHstring = %ARCHstring + " ARCH(" + @str(!i) + ")"
and:
Code: Select all
%GARCHstring = %GARCHstring + " GARCH(" + @str(!j) + ")"
Which means that you are in fact building up this:
Code: Select all
ARCH(ARCH(1),GARCH(1),egarch) dow1 c
ARCH(ARCH(1) ARCH(2),GARCH(1),egarch) dow1 c
ARCH(ARCH(1) ARCH(2) ARCH(3),GARCH(1),egarch) dow1 c
...
...
...
ARCH(ARCH(1), GARCH(1) GARCH(2),egarch) dow1 c
ARCH(ARCH(1), GARCH(1) GARCH(2) GARCH(3),egarch) dow1 c
Which is why you're getting the errors.
So you need to change your specification of %archstring and %garchstring so that they create the correct syntax.
Follow us on Twitter @IHSEViews
Re: Automatic ARMA selection
Sorry it may be very easy or basic for you but the situation is different for me. If it is possible may I ask the solution to get the correct specification if it is not a problem for you?
Thank you very much.
Thank you very much.
Re: Automatic ARMA selection
I made
%ARCHstring = "!i"
and got some results. I think this is correct solution.
thank you very much
%ARCHstring = "!i"
and got some results. I think this is correct solution.
thank you very much
Re: Automatic ARMA selection
Dear Gareth
How can I set a criterion of AIC for ARMA selection in x12 seasonal adjustment?
Thank you,
punjaphp
How can I set a criterion of AIC for ARMA selection in x12 seasonal adjustment?
Thank you,
punjaphp
Re: Automatic ARMA selection
Hi Gareth,
This code is actually very useful. Thank you for sharing.
However, as I tried running it, I am getting an error message "%matname is not a valid string or scalar name.". I am using Eviews 7. Will this code won't work on Eview 7?
Thank you in advance.
Warm Regards,
Priyanshi
This code is actually very useful. Thank you for sharing.
However, as I tried running it, I am getting an error message "%matname is not a valid string or scalar name.". I am using Eviews 7. Will this code won't work on Eview 7?
Thank you in advance.
Warm Regards,
Priyanshi
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13330
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Automatic ARMA selection
Thank you Gareth.
I tried running this in Eviews 6. It says "{%MATNAME} is not defined".
Please help. Thanks a lot!
Warm Regards,
Priyanshi
I tried running this in Eviews 6. It says "{%MATNAME} is not defined".
Please help. Thanks a lot!
Warm Regards,
Priyanshi
Return to “Program Repository”
Who is online
Users browsing this forum: No registered users and 3 guests