## Seasonal Unit root test

For questions regarding programming in the EViews programming language.

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

tcfoon
Posts: 54
Joined: Fri May 15, 2009 4:33 am

### Seasonal Unit root test

Hello there!

I would like to known whether the way I am writing the programme for seasonal unit root test developed by Beaulieu and Miron (1993) are correct? Particularly, in the generated series section.

Genr trend = @trend
Series D12Y = D(Y,0,12)
Series Y1 = Y + Y(-1) + Y(-2) + Y(-3) + Y(-4) + Y(-5) + Y(-6) + Y(-7) + Y(-8) + Y(-9) + Y(-10) + Y(-11)
Series Y2 = - Y + Y(-1) - Y(-2) + Y(-3) - Y(-4) + Y(-5) - Y(-6) + Y(-7) - Y(-8) + Y(-9) - Y(-10) + Y(-11)
Series Y3 = - Y(-1) + y(-3) - Y(-5) + Y(-7) - Y(-9) + Y(-11)
Series Y4 = - Y + Y(-2) - Y(-4) + Y(-6) - Y(-8) + Y(-10)
Series Y5 = 0.5*(- Y - Y(-1) + 2*Y(-2) - Y(-3) - Y(-4) + 2*Y(-5) - Y(-6) - Y(-7) + 2*Y(-8) - Y(-9) - Y(-10) + 2*Y(-11))
Series Y6 = (@sqrt(3)/2)*(Y - Y(-1) + Y(-3) - Y(-4) + Y(-6) - Y(-7) + Y(-9) - Y(-10))
Series Y7 = 0.5*(Y - Y(-1) - 2*Y(-2) - Y(-3) + Y(-4) + 2*Y(-5) + Y(-6) - Y(-7) - 2*Y(-8) - Y(-9) + Y(-10) + 2*Y(-11))
Series Y8 = (@sqrt(3)/2)*(Y - Y(-1) + Y(-3) + Y(-4) - Y(-6) - Y(-7) + Y(-9) + Y(-10))
Series Y9 = 0.5*(- @sqrt(3)*Y + Y(-1) - Y(-3) + @sqrt(3)*Y(-4) - 2*Y(-5) + @sqrt(3)*Y(-6) - Y(-7) + Y(-9) - @sqrt(3)*Y(-10) + 2*Y(-11))
Series Y10 = 0.5*(Y - @sqrt(3)*Y(-1) + 2*y(-2) - @sqrt(3)*y(-3) + y(-4) - y(-6) + @sqrt(3)*y(-7) - 2*y(-8) + @sqrt(3)*y(-9) - y(-10))
Series Y11 = 0.5*(@sqrt(3)*Y + Y(-1) - Y(-3) - @sqrt(3)*Y(-4) - 2*Y(-5) - @sqrt(3)*Y(-6) - Y(-7) + Y(-9) + @sqrt(3)*Y(-10) + 2*Y(-11))
Series Y12 = 0.5*(- Y - @sqrt(3)*Y(-1) - 2*Y(-2) - @sqrt(3)*Y(-3) - y(-4) + Y(-6) + @sqrt(3)*Y(-7) + 2*y(-8) + @sqrt(3)*Y(-9) + Y(-10))

'create seasonal dummies
for !i=1 to 11
series s!i = @seas(!i) - @seas(12)
next

EQUATION EQ.LS D12Y Y1(-1) Y2(-1) Y3(-1) Y4(-1) Y5(-1) Y6(-1) Y7(-1) Y8(-1) Y9(-1) Y10(-1) Y11(-1) Y12(-1) C TREND S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 D12Y(-1 to -12)

Thank you,

Regards,
tcfoon
Last edited by tcfoon on Sun Sep 04, 2011 3:54 am, edited 1 time in total.

Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

### Re: Seasonal Unit root test

There is a programming example of seasonal unit root testing (i.e. HEGY) for monthly series in the "Program Repository" section of the forum. You may want to check it for comparison purposes. Here is the direct link: http://forums.eviews.com/viewtopic.php?f=15&t=301

tcfoon
Posts: 54
Joined: Fri May 15, 2009 4:33 am

### Re: Seasonal Unit root test

Hi,

Thank you for the information, I have go through the suggested command but that is for Franses (1991) seasonal unit root test for monthly data. In fact, I am looking for Beaulieu and Miron (1993) seasonal unit root test for monthly data. My concern is whether I am correctly generate the data for Y1, Y2,...Y3 or not. In fact, I do test the suggested command, but the output is far away different from JMulti, in addition, my Beaulieu and Miron (1993) output also differ from RATS output. Therefore, I am not sure whether the way I am generating the Y series is correct or not.

Thank you,

Regards,
tcfoon
Last edited by tcfoon on Sun Sep 04, 2011 3:54 am, edited 1 time in total.

tcfoon
Posts: 54
Joined: Fri May 15, 2009 4:33 am

### Re: Seasonal Unit root test

Hello!!

I have slightly improved the exiting sub-routine in the Eview forum for monthly seasonal unit root tests. My question is that is it plausible to ask Eviews to run the sub-routine for each series in a group and how is the programme. I saw an ADF programme work in this way but I am not sure how to incorporate into my sub-routine programme then work by the “call” command. The programe is as follow:

group g *
g.drop resid 'put every series in the workfile into a group

for !i=1 to g.@count 'loop through every series in the first group
%name = g.@seriesname(!i) 'grab the current series name

next

Thank you,

Regards,
tcfoon
Attachments
sub_hegyfs-m-all.prg
Last edited by tcfoon on Sun Sep 04, 2011 3:53 am, edited 1 time in total.

Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

### Re: Seasonal Unit root test

You can either modify the argument in the subroutine and change it to a group instead of series or you can simply define another loop in the program outside the subroutine:

Code: Select all

`for !j = 1 to mygroup.@count  call hegyf(myggroup(!j))  table info!j = info_criterionnextsubroutine hegyf(series y).......endsub`

tcfoon
Posts: 54
Joined: Fri May 15, 2009 4:33 am

### Re: Seasonal Unit root test

Sorry, what I mean is running the seasonal unit root test for each series in a group. Is it plausible??

Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

### Re: Seasonal Unit root test

Yes, I think so. I do not see any reason why it would be implausible.

tcfoon
Posts: 54
Joined: Fri May 15, 2009 4:33 am

### Re: Seasonal Unit root test

Thank you very much just now I re-try again and the code is running.

Thank you very much...and the Eviews forum is very useful to enhance my knowledge and sharing..

raquelopez
Posts: 8
Joined: Fri Apr 01, 2011 1:42 am

### Re: Seasonal Unit root test

Hi "tcfoon",

I have just gone through this topic. So, regarding the programming for the test developed by Beaulieu and Miron (1993) that you included at the beginning of this post, is it then the final version of the test or did you include any further modification? I´m not sure but I think the file that you attached later in this post is about Franses(1991). Am I right?

Thank you very much for sharing your programming with other people,
Raquel

raquelopez
Posts: 8
Joined: Fri Apr 01, 2011 1:42 am

### Re: Seasonal Unit root test

Hi again,
I have a new question. Please, could you tell me the reason of subtracting the dummy variable corresponding to December in "series s!i = @seas(!i) - @seas(12)"?
Thanks,
Raquel

somegek
Posts: 1
Joined: Tue Aug 04, 2015 12:34 am

### Re: Seasonal Unit root test

It is a bit late to reply after 6 years, but here might be the reason why your results are different from other programs.
your Series Y8 = (@sqrt(3)/2)*(Y - Y(-1) + Y(-3) + Y(-4) - Y(-6) - Y(-7) + Y(-9) + Y(-10))
This Y should be a -y, because you let out the - sign from the sqrt(3)/2
There might be other possible errors, but the formula are not exactly the same as the paper, which I mean the sign - is often combined in the formula, make it harder to read the code.

On the other hand, someone asked about why the seasonal dummies is seas(i)-seas(12). This can be viewed as the seasonal dummies and their deviation from the mean of the dummies.
Consider Seas(i), for i not 12, then the effect of the dummies is constant + seas(i). When i=12, the effect of the dummies will be constant - sum(dummies(i = 1 to 11)). This also means the 12th month seasonal dummy is - sum(dummies(i=1 to 11)).
Now consider the mean of all seasonal dummies, the seasonal dummies will cancel each other out, leaving only the mean of the constant over, which is a constant. This leads to the constant in this equation equals the constant of the seasonal adjusted series.

Hope this helps the other people who are also facing the seasonal unit root.

Please notify me if I'm wrong.

### Who is online

Users browsing this forum: No registered users and 1 guest