Gregory-Hansen Cointegration Test

For posting your own programs to share with others

Moderators: EViews Gareth, EViews Moderator

feka
Posts: 3
Joined: Mon May 25, 2015 9:56 pm

Re: Gregory-Hansen Cointegration Test

Postby feka » Tue May 26, 2015 6:53 am

Dear trubador,
Thank you for the prompt response. I try to create the single series for the independent variable, but I still have the same error message. I want to test call greghansen(lnx,lnm,2,"aic",6), Could you show me how to correctly define my series lnm to "group G ' group of independent variable(s) (including single series) " argument?
Many thanks for your kind help.

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

Re: Gregory-Hansen Cointegration Test

Postby trubador » Tue May 26, 2015 7:28 am

Code: Select all

group gr.add lnm
call greghansen(lnx,gr,2,"aic",6)

feka
Posts: 3
Joined: Mon May 25, 2015 9:56 pm

Re: Gregory-Hansen Cointegration Test

Postby feka » Tue May 26, 2015 7:54 am

Dear trubador,
Please do apologize me, but I've tried to follow your instruction and it did not work. Below I attach the program. Perhaps my mistake in another command or typo? Really sorry to bother you.
sincerely yours,
feka
Attachments
greghansenedit.prg
(5.45 KiB) Downloaded 740 times

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

Re: Gregory-Hansen Cointegration Test

Postby trubador » Tue May 26, 2015 12:05 pm

You are not bothering me at all.

You are just not following the instructions. First, create a group called "gr" in your workfile by typing the following syntax into the command line:

Code: Select all

group gr.add lnm


Make sure that there is now a group object in your workfile called "gr" and includes the series "lnm".

Now you can run the program code by changing the following line:

Code: Select all

call greghansen(lnx,gr,2,"aic",6)


At some point, I have to assume that you have a basic understanding of EViews and that you know how to manipulate data, at the very least. If you need help, there are very nice learning resources on EViews' website. I strongly suggest you to take a look at http://www.eviews.com/illustrated/illustrated.html and/or http://www.eviews.com/Learning/index.html before doing such complex analyses.

nhuphuong114
Posts: 4
Joined: Sat May 23, 2015 9:41 pm

Re: Gregory-Hansen Cointegration Test

Postby nhuphuong114 » Wed Jun 03, 2015 1:02 am

Dear Mr. Trubador!

I have a data spanning from 2005 to 2015, I divide into 3 sub-sample. I test unit roots for entire sample and 03 sub-samples.
For entire sample, all variables are I(1), however, 03 sub-samples are I(0). Can I employ GH test for each sub-samples?
Thank you in advance for your prompt support.
I'm looking forward to hearing from you!

Best regards!
Phuong Ha

Setyowati
Posts: 4
Joined: Tue Jun 09, 2015 10:08 pm

Re: Gregory-Hansen Cointegration Test

Postby Setyowati » Wed Jun 10, 2015 3:22 pm

Dear trubador and all members

i want to run the GH test for my data but i then i got message "Syntax error in "GHZ" (1,1) =? "Gregory-Hansen".
What should i do to fix this one? i attached my workfile and program.
need help in hurry. thank you so much.

Best Wishes,

Setyowati
Attachments
bismillah_run.wf1
eviews workfile
(48.83 KiB) Downloaded 650 times
gh.prg
program command
(4.79 KiB) Downloaded 704 times

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

Re: Gregory-Hansen Cointegration Test

Postby trubador » Thu Jun 11, 2015 12:04 am

Setyowati wrote:Dear trubador and all members

i want to run the GH test for my data but i then i got message "Syntax error in "GHZ" (1,1) =? "Gregory-Hansen".
What should i do to fix this one? i attached my workfile and program.
need help in hurry. thank you so much.

Best Wishes,

Setyowati

That is because all spaces are substituted with question marks "?" in your code. It might be a copy-paste problem, but you need to figure it out.

And please do not send private messages. There is really no need to. Once you have posted your question in the forum, I usually do my best to answer it.

Setyowati
Posts: 4
Joined: Tue Jun 09, 2015 10:08 pm

Re: Gregory-Hansen Cointegration Test

Postby Setyowati » Thu Jun 11, 2015 8:29 am

Dear Mr. trubador

thank you so much for your help, i am so new in eviews. i fixed it already then i get the result as follow

THE GREGORY-HANSEN
COINTEGRATION TEST
MODEL 2: Level Shift

ADF Procedure

t-stat -6.410.373
Lag 1.000.000
Break 2012M06

Phillips Procedure

Za-stat -1.129.511
Za-break 2008M07
Zt-stat -1.032.463
Zt-break 2008M07

how can i know if there is cointegration in my model?

Best Regards,

Setyowati

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

Re: Gregory-Hansen Cointegration Test

Postby trubador » Thu Jun 11, 2015 1:17 pm

Setyowati wrote:how can i know if there is cointegration in my model?

Table 1 of the original paper (Gregory and Hansen,JOE,1996) presents the asymptotic critical values for such purposes. In your case, 5% and 1% levels of significance would be -4.61 and -5.13, respectively. Therefore, you can reject the null hypothesis of no cointegration.

Setyowati
Posts: 4
Joined: Tue Jun 09, 2015 10:08 pm

Re: Gregory-Hansen Cointegration Test

Postby Setyowati » Fri Jun 12, 2015 5:53 am

Dear Trubador

Thank you so much for your explanation. it is so helpful, i will learn more about this.

Best Wishes,

Setyowati

R. Jassy
Posts: 5
Joined: Fri Nov 11, 2011 6:31 am

Re: Gregory-Hansen Cointegration Test

Postby R. Jassy » Mon Jun 22, 2015 4:10 am

Dear Eren and Tang,
Thank you for all the help and support, i appreciate.
I have 2 questions:
1. Is it possible to make the Gregory-Hansen Cointegration test with a known break point.
2. What does the number 19-2 indicate in the variable '@TREND>19-2'?
Thank you in advance for your reply
Kind Regards,
Yasmine

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

Re: Gregory-Hansen Cointegration Test

Postby trubador » Mon Jun 29, 2015 6:23 am

R. Jassy wrote:1. Is it possible to make the Gregory-Hansen Cointegration test with a known break point.

I think it is doable. Try changing the following lines:

Code: Select all

...
!lower = @round(@obs(Y)*!trim)
!upper = @round(@obs(Y)*(1-!trim))
...

For instance, if you would like to generate the statistics for a particular breakpoint, say 44, then simply write:

Code: Select all

...
!lower = 44+1
!upper = 44+1
...
It will generate the relevant statistics for 44th observation, but you'll need to refer to original paper for use the table for critical values there for hypothesis testing.
R. Jassy wrote:2. What does the number 19-2 indicate in the variable '@TREND>19-2'?

You can always try these things in EViews and see it for yourself.
It simply generates a binary dummy variable starting as of 19th observation. These days we do it with the following command:

Code: Select all

@after("19")

R. Jassy
Posts: 5
Joined: Fri Nov 11, 2011 6:31 am

Re: Gregory-Hansen Cointegration Test

Postby R. Jassy » Tue Jun 30, 2015 2:21 am

Thank you for your reply, I appreciate.

msvanidze
Posts: 2
Joined: Sun Dec 07, 2014 9:27 am

Re: Gregory-Hansen Cointegration Test

Postby msvanidze » Wed Jul 01, 2015 7:06 am

Thanks for this topic and code itself!

I am not good with programming. I just copied your code, inserted it in new program file, and executed commands. however, in the very beginning I received such error message "GREGHANSEN is not a defined subroutine in “CALL GREGHANSEN(y,x, “AIC”, 6)”. p.s. I called my data y and x as given in the initial code. I am working with EViews 8. Could you detect what is wrong with my trial?

Thank you!
Best,
Miranda

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

Re: Gregory-Hansen Cointegration Test

Postby trubador » Wed Jul 01, 2015 10:56 am

msvanidze wrote:Thanks for this topic and code itself!

I am not good with programming. I just copied your code, inserted it in new program file, and executed commands. however, in the very beginning I received such error message "GREGHANSEN is not a defined subroutine in “CALL GREGHANSEN(y,x, “AIC”, 6)”. p.s. I called my data y and x as given in the initial code. I am working with EViews 8. Could you detect what is wrong with my trial?

Thank you!
Best,
Miranda

You should "Run" the program file as a whole, not execute it line by line.


Return to “Program Repository”

Who is online

Users browsing this forum: No registered users and 18 guests