Chow test at all possible break points

For questions regarding programming in the EViews programming language.

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

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 11:28 pm

Dear Gareth, i find the way to get the table with the following command breakls(method=glob,select=high) series01 c series01(-1) [i can't freeze the result in a table when i use this way] or
freeze(tab)eq.multibreak(method=globinfo), using the last one how can i extract the breakdates from the freeze table because the dates are in different rows and in one cell could appear 2 or 5 dates..
is like that
Estimated break dates:
1: 1982M01 -> all in one cell position (25,A)
2: 1965M08, 1991M05 -> also in on cell position (26,A) ...and so on

thank you very much for your help!!!.

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

Re: Chow test at all possible break points

Postby gisi » Thu Nov 13, 2014 11:35 am

freeze(table)eq.breakls(method=glob) series01 c series01(-1)
@wsplit(@right(table(9,1),44)) ' create svector

it looks like this:
1956M09,
1965M08,
1973M10,
1982M01,
1991M06

is it possible to transform this svector into a date vector??

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

Re: Chow test at all possible break points

Postby EViews Gareth » Thu Nov 13, 2014 11:38 am

There is no such thing as a date vector.

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

Re: Chow test at all possible break points

Postby gisi » Thu Nov 13, 2014 11:52 am

Is there any command to fix that value?? or to freeze the vector and ask for its value?? :(

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

Re: Chow test at all possible break points

Postby EViews Gareth » Thu Nov 13, 2014 12:10 pm

What do you mean by value?

I don't get what you're trying to do with the dates.

You can use the @dateval function to convert the string representation of a date into the EViews internal integer value for that date. But I can't see what you'd do with that integer.

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

Re: Chow test at all possible break points

Postby gisi » Fri Nov 14, 2014 5:59 am

i want to use these value to create dummies and estimate the model with the break date..
so it will be something like that:


scalar Model
if white(!i+1) <0.05 then
Model=1="Model 1: Bootstrap homoskedastic"
else Model=2="Model 2: Bootstrap heteroskedastic"
endif


'!rep=2 'number of replications (bootstrap)
'!n = @obs{%dep}
'!m=@obs{%regs}
'vector(!rep) boot
'for !j=1 to !rep
'{%dep}.resample Yb
'boot(!j)=@var(Yb)

freeze(breakdatetable) eq1.multibreak(method=globinfo) 'to obtain the break dates
@wsplit(@right(table(9,1),44)) 'svector breakdates


if Model=1 then
equation eq1ho{!i,!j}.ls Yb {%regs}
eq1ho.makeresid res1
'series dummy=@recode(@date>@dateval("breakdate"), 1,0) '
'equation eq2ho{!i,!j}.ls Yb {%regs} {%regs}*dummy
'eq2ho.makeresid res2
'Ft(b)= ((!n-!m)*res1-(!n-2*!m)*res2)/res2

'else if Model=2 then
'equation eq1he{!i,!j}.ls Yb {%regs}
'eq1he.makeresid res1
'series dummy=@recode(@date>@dateval("breakdate"), 1,0)
'equation eq2he{!i,!j}.ls Yb {%regs} {%regs}*dummy
'eq2he.makeresid res2
'Ft(b)= ((!n-!m)*res1-(!n-2*!m)*res2)/res2
'endif
'endif
next
'next
'next

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

Re: Chow test at all possible break points

Postby EViews Gareth » Fri Nov 14, 2014 9:06 am

ok, that would work, although you might want to look up the @after and @before functions too.

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

Re: Chow test at all possible break points

Postby gisi » Fri Nov 21, 2014 9:13 am

:) i am trying to store the value in a vector but i get the following error message: An unnamed object cannot be converted to a string in "BREAK=@DATEVAL(@WSPLIT(@RIGHT(TABLE(9,1),44)))"


vector(5) break
freeze(table)eq.breakls(method=glob)series01 c series01(-1)
break=dateval(@wsplit(@right(table(9,1),44)))

what can i do? :(

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

Re: Chow test at all possible break points

Postby EViews Gareth » Fri Nov 21, 2014 9:17 am

Code: Select all

break=@dateval(@right(table(9,1),44))

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

Re: Chow test at all possible break points

Postby gisi » Sun Nov 23, 2014 7:14 am

the problem with this command is that the vector is being fulfilled with NA :?

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

Re: Chow test at all possible break points

Postby gisi » Fri Dec 05, 2014 7:56 am

Dear Gareth,
I have some problems trying to calculate the Wald statistics, could you please help me

vector Model
if white(!i+1) <0.05 then
Model=1'="Model 1: Bootstrap homoskedastic"
else Model=2'='Model 2: Bootstrap heteroskedastic"
endif

'Bootstrap
!rep=645 'number of replications
vector(!rep) boot
for !j=1 to !rep
{%dep}.resample Yb
boot(!j)=@var(Yb)

table breaks 'to obtain the break dates
freeze(tablebreakls)eq1.breakls(method=glob) series01 c series01(-1)
svector dates= @wsplit(@right(tablebreakls(9,1),44)) 'svector breakdates
for !i=1 to 5
%date = @left(dates(!i),7)
breaks(!i,1)=%date
next
show breaks

if Model=1 then
'Under the null hypothesis(stability)
equation eq1ho{!i}_{!j}.ls Yb {%regs}
'Under the alternative hypothesis(structural break)
series dummy=@recode(@date>@dateval("breaks"), 1,0) '
equation eq2ho{!i}_{!j}.ls Yb {%regs} {%regs}*dummy
'Bootstrap Wald statistic
Ft(b)= ((eq1ho{!i}_{!j}.@regobs-eq1.@ncoef)*(eq1ho{!i}_{!j}.@se)^2)-(eq2ho{!i}_{!j}.@regobs-2*eq2.@ncoef)*(eq2ho{!i}_{!j}.@se)^2))/(eq2ho{!i}_{!j}.@se)^2)

else if Model=2 then
'Under the null hypothesis(stability)
equation eq1he{!i}_{!j}.ls Yb c series01(-1)
'Under the alternative hypothesis(structural break)
series dummy=@recode(@date>@dateval("breaks"), 1,0)
equation eq2he{!i}_{!j}.ls Yb c series01(-1) series01(-1)*dummy
'Bootstrap Wald statistic
Ft(b)= ((eq1he{!i}_{!j}.@regobs-eq1.@ncoef)*(eq1he{!i}_{!j}.@se)^2)-(eq2he{!i}_{!j}.@regobs-2*eq2.@ncoef)*(eq2he{!i}_{!j}.@se)^2))/(eq2he{!i}_{!j}.@se)^2)
endif
endif
next
next

error message: insufficient number of observations in “EQUATION EQ2HE{!I}_{!J}”.LS YB C SERIES01(-1) SERIES01(-1)*DUMMY"

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

Re: Chow test at all possible break points

Postby EViews Gareth » Fri Dec 05, 2014 9:33 am

Sounds like you don't have enough observations to run that regression. You probably have all NAs in the current sample.

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

Re: Chow test at all possible break points

Postby gisi » Thu Dec 11, 2014 9:07 am

Dear Gareth,
You are right the problem is that the dummy is fulfills with NA.. And maybe the reason is that the @dateval(breaks,1,0) give me the date in the following format "YYYYMM" and the @date give me "MM/1/YYYY" how can I change one of them? Is there any possibility to transform the svector to same format to @date or anyway to establish that the @date is express just in year and month without the first day of every month?
Thank you very much for your guidance


table breaks 'to obtain the break dates
freeze(tablebreakls)eq1.breakls(method=glob) series01 c series01(-1)
svector dates= @wsplit(@right(tablebreakls(9,1),44)) 'svector breakdates
for !i=1 to 5
%date = @left(dates(!i),7)
breaks(!i,1)=%date
next
show breaks

'breaks=@dateval(@str(breaks),"MMDDYYYY") 'trying
'date=@meansby(@date,year,month) 'trying

if Model=1 then
'Under the null hypothesis(stability)
equation eq1ho{!i}_{!j}.ls Yb {%regs}
'Under the alternative hypothesis(structural break)
for f!=1 to 5
series dummy=@recode(@date>@date("breaks(!f,1)"), 1,0) '
equation eq2ho{!i}_{!j}.ls Yb {%regs} {%regs}*dummy
next
'Bootstrap Wald statistic
Ft(b)= ((eq1.@regobs-eq1.@ncoef)*res1-(eq1.@regobs-2*eq1.@ncoef)*res2)/res2

else if Model=2 then
'Under the null hypothesis(stability)
equation eq1he{!i}_{!j}.ls Yb c series01(-1)
'Under the alternative hypothesis(structural break)
series dummy=@recode(@date>@dateval("breaks(1,1)" , 1,0)
equation eq2he{!i}_{!j}.ls Yb c series01(-1) series01(-1)*dummy
'Bootstrap Wald statistic
Ft(b)= ((eq1he{!i}_{!j}.@regobs-eq1.@ncoef)*(eq1he{!i}_{!j}.@se)^2)-(eq2he{!i}_{!j}.@regobs-2*eq2.@ncoef)*(eq2he{!i}_{!j}.@se)^2))/(eq2he{!i}_{!j}.@se)^2)
endif
endif
next
next

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

Re: Chow test at all possible break points

Postby EViews Gareth » Thu Dec 11, 2014 10:13 am

Change:

Code: Select all

series dummy=@recode(@date>@date("breaks(!f,1)"), 1,0) '
to be:

Code: Select all

%date = breaks(!f,1) series dummy=@recode(@date>@dateval(%date), 1,0)
And then a similar change for the other dummy declarations.

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

Re: Chow test at all possible break points

Postby gisi » Fri Dec 19, 2014 7:59 am

thank you very much :) it works!!.
Dear Gareth, with the following commands, the software knows that i want it to calculate the white test of the break date and compare if it is lower than 0.05, in the case it is, it should use model 1 else model 2, after that, it should repeat this procedure on the 4 remaining breaks date. Leaving in the vector "Model" that model used for those 5 breaks?.

for !f=1 to 5
%date=breaks(!f,1)
vector(5,1) Model
if white(@dtoo(%date))<0.05 then Model=1
else Model=2
endif
next


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests