Page 1 of 3
Chow test at all possible break points
Posted: Tue May 21, 2013 8:25 am
by FiliusPublii
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
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
Re: Chow test at all possible break points
Posted: Tue May 21, 2013 8:33 am
by EViews Gareth
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...
Re: Chow test at all possible break points
Posted: Wed May 22, 2013 5:48 am
by FiliusPublii
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
Re: Chow test at all possible break points
Posted: Wed Nov 05, 2014 1:51 am
by gisi
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,
Re: Chow test at all possible break points
Posted: Wed Nov 05, 2014 8:53 am
by EViews Gareth
I'm not sure I follow.
Re: Chow test at all possible break points
Posted: Fri Nov 07, 2014 3:27 am
by gisi
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".
Re: Chow test at all possible break points
Posted: Fri Nov 07, 2014 10:45 am
by EViews Gareth
That means you've tried to test a date that wasn't in the original equation's sample.
Re: Chow test at all possible break points
Posted: Sat Nov 08, 2014 7:00 am
by gisi
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"
equation eq1.ls({%CovOpt}) {%dep} {%regs}
eq1.white
Re: Chow test at all possible break points
Posted: Sat Nov 08, 2014 8:08 am
by EViews Gareth
Is your copy of EViews up to date?
Re: Chow test at all possible break points
Posted: Sat Nov 08, 2014 3:05 pm
by gisi
I'm using Eviews 8 :)
Re: Chow test at all possible break points
Posted: Sat Nov 08, 2014 3:32 pm
by EViews Gareth
Is it up to date?
Re: Chow test at all possible break points
Posted: Wed Nov 12, 2014 3:39 am
by gisi
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
Re: Chow test at all possible break points
Posted: Wed Nov 12, 2014 9:17 am
by EViews Gareth
eq.breakspec
Re: Chow test at all possible break points
Posted: Wed Nov 12, 2014 1:26 pm
by gisi
it shows an error message with the following text "Not available with this estimation model" :(
Re: Chow test at all possible break points
Posted: Wed Nov 12, 2014 1:57 pm
by EViews Gareth
Sorry, I thought you were doing breakpoint estimation, not testing.
You want equation.breaktest