Page 1 of 1

Generate Recursive Dummy

Posted: Thu Nov 19, 2009 7:04 pm
by kipfilet
Hello all. I am working with a monthly time series workfile, and am trying to detect the specific date of a structural break in a regression. In order to achieve that, I have thought of generating a dummy and estimating the OLS regression n times. At the first iteration, the dummy would take value 1 from @first to @first+1 and 0 onwards. At the second iteration, it would take value 1 from @first to @first+2 and 0 onwards, and so on. Then, I would take the R-squared from each of the observations and would be able to detect at which date the structural break would take place (by seeing at which date the dummy would maximise the r-squared). This may seem a bit basic, but I am not very good at eviews programming. The program I have written so far is the following:

workfile taylor m 1999m01 2009m10

scalar itera=130
series(itera) rsqrdummy

!i=1
while !i<itera+1

smpl @first @first+3+!i
series dummy=1
smpl @first+3+!i @last
series dummy=0

equation eq02.ls eonia c infl_h indgap dummy

rsqrdummy(!i,1)=eq02.@rbar2

!i=!i+1
wend

But this yields a near singular matrix! What am I doing wrong? Thank you for your time.

Re: Generate Recursive Dummy

Posted: Fri Nov 20, 2009 2:12 am
by trubador
The following modified version might help:

Code: Select all

workfile taylor m 1999m01 2009m10 scalar itera=130 series(itera) rsqrdummy !i=1 while !i<itera-3 smpl @first @first+2+!i series dummy=1 smpl @first+3+!i @last series dummy=0 smpl @all equation eq02.ls eonia c infl_h indgap dummy rsqrdummy(!i,1)=eq02.@rbar2 !i=!i+1 wend