Chow test at all possible break points

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

FiliusPublii
Posts: 3
Joined: Tue May 21, 2013 8:16 am

Chow test at all possible break points

Postby FiliusPublii » Tue May 21, 2013 8:25 am

Dear all,

I'm trying to test a multiple OLS regression for structural breaks at all observation points (first time that google/this forum doesn't help with an answer, hard to find apparently...).

My question is very simple: how do I move the observation point for the Chow test one step at time? Say my sample starts at 1992:2 (quarterly), I want to do something like this:

Code: Select all

for !c=-1 to !c=100
olsmulti.chow 1992:2+!c
next


I just get error messages here, I don't know how to tell eviews to go to 1992:3 then 1992:4 1993:1 etc. The command

Code: Select all

@first+!c
is problematic because in the chow test, the @ is reserved for subsets of regressors so I just get normal OLS equation if I do that, not a test result...

If you help me with this, collecting the results into a matrix will be fine. I just want to find my breakpoint with Chow... ;-)

Any help would be appreciated!
Filius Publii

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: Chow test at all possible break points

Postby EViews Gareth » Tue May 21, 2013 8:33 am

Probably something like:

Code: Select all

%date = @otod(@dtoo("1992:2")+!c)
olsmulti.chow {%date}


I should point out that you might want to just use the built in quandt-andrews test instead...
Follow us on Twitter @IHSEViews

FiliusPublii
Posts: 3
Joined: Tue May 21, 2013 8:16 am

Re: Chow test at all possible break points

Postby FiliusPublii » Wed May 22, 2013 5:48 am

Great, thanks so much!

In case someone googles this later, the code at the end looked like this:

Code: Select all

matrix(32, 1)  chow
!c=-1
for !i=0 to 31
!c=!c+1
%date = @otod(@dtoo("1997:1")+!c)
freeze(test{!c})olsmulti.chow {%date}
scalar Fvaluechow{!c}=@val(test{!c}(6,5))
chow(!c+1,1) = Fvaluechow{!c}
delete test{!c}
delete Fvaluechow{!c}
next


which I am sure can be done more elegantly but it works... ;-)

I know that there are tests for unknown break dates but this is what I was asked to do. I'll try some others as well to see if they give the same result. I'm guessing that in a sample of, say, 40 different break dates my loop above will (at a 95% confidence interval) already produce two wrong results so I do see the point.

All the best,
Filius Publii

gisi
Posts: 15
Joined: Mon Nov 03, 2014 12:03 pm

Re: Chow test at all possible break points

Postby gisi » Wed Nov 05, 2014 1:51 am

Dear Mr. Gareth,
I am so sorry to bother you, i am beginner with programming in Eviews..i just want to ask for your suggestion about how to plot the sequence of Chow statistics as a function of candidate break dates.. i was trying to follow your comments about that in some forums but it was unsuccessful..
the data is a monthly time series from March 1947 to April 2001..(650 observations)
the variable series01 is the growth rate of ratio of the Industrial Production index for manufacturing/durables to average weekly labor hours (Hansen's paper 2001)..is AR(1) process

the codes that I am using are below:

'Open a workfile
wfopen hol
smpl 1947m3 2001m4
'-----------------------------
%dep="" 'variable to store name of dependent variable
%regs= "c" ' variable to store list of regressors. Default is "c" for a constant
'%sample="@all" 'variable used to store sample. Default is "@all" for entire workfile
!doCovs=0 ' variable used to store choice of whether to display covariance options
!CovChoice=0' variable specify choice of covariance matrix.
!result=0 ' variable that will track the result of dialogs. -1indicates user hit cancel. 0 indicates user hit ok
%CovList="Default White HAC" ' list of covariance types for use in covariance dialog
%CovOpt="" 'cov option string

!result=@uidialog("edit",%dep,"Enter the dependent variable","edit",%regs,"Enter the list of regressors","edit", %sample,"Enter the equation sample","check",!doCovs,"View covariance options?") 'put up dialog
if !result=-1 then 'if user cancelled, then stop program
stop
endif

if !doCovs=1 then 'user indicates that wishes to view the covariance dialog, 0 otherwise
!result=@uilist(!CovChoice, "Covariance options", %CovList) 'put up dialog
if !result=-1 then
stop
endif

if !CovChoice =2 then
%CovOpt="cov=white"
else if !CovChoice =3 then
%CovOpt="cov=hac"
endif
endif
endif

'smpl{%sample} 'set the sample
'create a vector to store chow test
vector(54) chow
equation eq1.ls({%CovOpt}) {%dep} {%regs} 'estimate equation.
for !i=1947m3 to 2001m4 [THIS IS THE PROBLEM, is not well defined]
eq1.chow {!i}
next


'Chow test, the break date is known a priori
freeze(t1) eq1.chow 1973 'fail to find evidence of structural break(5% critical value from chi-squared distribution is 6)
freeze(t2) eq1.chow 1975 'exceeds 5% critical value, provides evidence of structural break.

'Andrews-Quandt TEST for unknown breakpoint, 15% trimming
freeze(QuandtAndrewstab) eq1.ubreak 15


'------------------------------
some trying in order to estimate breakpoints

'smpl 1947m1 1982m12
'equation eq1_1.ls series01 c series01(-1)

'smpl 1983m1 2001m4
'equation eq1_2.ls series01 c series01(-1)

'matrix wald= @transpose(@identity(eq1.@ncoef)*(eq1_1.@coefs-eq1_2.'@coefs))*@inverse(eq1_1.@cov/(eq1_1.@se)^2+eq1_2.@cov/(eq1_2.@se)^2)'*@identity(eq1.ncoef)*(eq1_1.@coefs -eq1_2.@coefs)
'wald= wald*(eq1.@regobs -2*eq1.@ncoef)/(eq1_1.@ssr +eq1_2.@ssr)

'Store coefficients into matrix
'colplace(coefmat,eq1_1@coefs)
'colplace(coefmat,eq1_2@coefs)

In the last part I was trying to estimate the break(unknown a priori) but i do not know how..
and additionally how can I construct a for loop for more than one break?
please kindly help me,
thank you very much in advance,
Best regards,

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: Chow test at all possible break points

Postby EViews Gareth » Wed Nov 05, 2014 8:53 am

I'm not sure I follow.
Follow us on Twitter @IHSEViews

gisi
Posts: 15
Joined: Mon Nov 03, 2014 12:03 pm

Re: Chow test at all possible break points

Postby gisi » Fri Nov 07, 2014 3:27 am

trying to improve the first part:
vector(650) chow 'create a vector to store chow test
equation eq1.ls({%CovOpt}) {%dep} {%regs} 'estimate equation.
!c=-1
for !i=0 to 650
!c=!c+1
%date=@otod(@dtoo("1947m03")+!c)
freeze(test{!c})eq1.chow {%date}
scalar Fvaluechow{!c}=@val(test{!c}(3,2))
chow(!c+1,1)= Fvaluechow{!c}
delete test{!c}
delete Fvaluechow{!c}
next

but when i run that i get the following error: 1947m03 is outside the equation's sample range in "FREEZE(TEST0)EQ1.CHOW 1947M03".

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: Chow test at all possible break points

Postby EViews Gareth » Fri Nov 07, 2014 10:45 am

That means you've tried to test a date that wasn't in the original equation's sample.
Follow us on Twitter @IHSEViews

gisi
Posts: 15
Joined: Mon Nov 03, 2014 12:03 pm

Re: Chow test at all possible break points

Postby gisi » Sat Nov 08, 2014 7:00 am

thank you very much for your help!!!!.. :D
i have now the following error:
@GRAD is not a Genr or series expression function in "@GRAD(1)ˆ2" in "DO_EQ1.WHITE" :cry:

equation eq1.ls({%CovOpt}) {%dep} {%regs}
eq1.white

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: Chow test at all possible break points

Postby EViews Gareth » Sat Nov 08, 2014 8:08 am

Is your copy of EViews up to date?
Follow us on Twitter @IHSEViews

gisi
Posts: 15
Joined: Mon Nov 03, 2014 12:03 pm

Re: Chow test at all possible break points

Postby gisi » Sat Nov 08, 2014 3:05 pm

I'm using Eviews 8 :)

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: Chow test at all possible break points

Postby EViews Gareth » Sat Nov 08, 2014 3:32 pm

Is it up to date?
Follow us on Twitter @IHSEViews

gisi
Posts: 15
Joined: Mon Nov 03, 2014 12:03 pm

Re: Chow test at all possible break points

Postby gisi » Wed Nov 12, 2014 3:39 am

thanks!!!...sorry for bother you but how can I store the Estimated break dates from Bai-Perron.. it is very easy to obtain it by clicking (Views/stabilityDiagnostics/multiple Breakpoint Test......Test specification: Method: Global information criteria)but how can I obtain it programming.. i was trying to store the SSRs in order to perform all the procedure like below but i get an error

wfopen data
vector(646) SSR 'create a vector to store SSR
for !i=1 to 645
%date=@otod(@dtoo("1947m05")+!i)
smpl 1947m03 1947m03+!i+1
equation eq1{!i}.ls series01 c AR(1)
freeze(tab{!i})eq1{!i}.@ssr {%date}
scalar valueSSR{!i}=@value(tab{!i}(15,2))
SSR(!i+1)=valueSSR{!i}
delete tab{!i}
delete valueSSR{!i}
next

error: 1947M06 is not defined in "FREEZE(TAB1) EQ11.@SSR 1947M06"
Do you know maybe how to obtain the break date in an easy way?? thank you very much

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: Chow test at all possible break points

Postby EViews Gareth » Wed Nov 12, 2014 9:17 am

eq.breakspec
Follow us on Twitter @IHSEViews

gisi
Posts: 15
Joined: Mon Nov 03, 2014 12:03 pm

Re: Chow test at all possible break points

Postby gisi » Wed Nov 12, 2014 1:26 pm

it shows an error message with the following text "Not available with this estimation model" :(

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13323
Joined: Tue Sep 16, 2008 5:38 pm

Re: Chow test at all possible break points

Postby EViews Gareth » Wed Nov 12, 2014 1:57 pm

Sorry, I thought you were doing breakpoint estimation, not testing.

You want equation.breaktest
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 27 guests