Gregory-Hansen Cointegration Test

For posting your own programs to share with others

Moderators: EViews Gareth, EViews Moderator

llenk01
Posts: 5
Joined: Sat Aug 29, 2015 5:41 am

Re: Gregory-Hansen Cointegration Test

Postby llenk01 » Wed Sep 02, 2015 5:16 am

Hello there,

I am using the Gregory Hansen Test to look for relationships between four European stock markets (UK, France, Germany and Spain) and US. I am testing the relationship in pairs and weirdly I am getting the same results when testing with the same dependent variable (please see the attached photo). For example I have the same result for the following pairs US-Spain, UK-Spain, Germany-Spain, France-Spain. Any idea why? Is the test valid at all?

Here is a part of the formula:

group group1
group1.add lnfr
call greghansen(lnes,group1,4,"aic",6)
Attachments
results.JPG
results.JPG (150.54 KiB) Viewed 4943 times

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

Re: Gregory-Hansen Cointegration Test

Postby trubador » Wed Sep 02, 2015 7:14 am

Hard to say without seeing the workfile.

llenk01
Posts: 5
Joined: Sat Aug 29, 2015 5:41 am

Re: Gregory-Hansen Cointegration Test

Postby llenk01 » Wed Sep 02, 2015 7:40 am

Hi Trubador,

Please see the attached file.
Attachments
econometrics ii project.wf1
(363.05 KiB) Downloaded 157 times

llenk01
Posts: 5
Joined: Sat Aug 29, 2015 5:41 am

Re: Gregory-Hansen Cointegration Test

Postby llenk01 » Wed Sep 02, 2015 7:40 am

And the program attached
Attachments
gh02.prg
(4.77 KiB) Downloaded 169 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 Sep 03, 2015 2:04 am

llenk01 wrote:Hello there,

I am using the Gregory Hansen Test to look for relationships between four European stock markets (UK, France, Germany and Spain) and US. I am testing the relationship in pairs and weirdly I am getting the same results when testing with the same dependent variable (please see the attached photo). For example I have the same result for the following pairs US-Spain, UK-Spain, Germany-Spain, France-Spain. Any idea why? Is the test valid at all?

Here is a part of the formula:

group group1
group1.add lnfr
call greghansen(lnes,group1,4,"aic",6)

Each time you run the code, you populate group1 with additional dependent variables. Make sure that you drop the second dependent variable after each run. The following snippet of code might be more useful:

Code: Select all

mode quiet
%y1 = "lnes"
%y2 = "lnfr"
group x.add {%y2}
call greghansen({%y1},x,4,"aic",6)
x.drop {%y2}
'... [rest of the program]

llenk01
Posts: 5
Joined: Sat Aug 29, 2015 5:41 am

Re: Gregory-Hansen Cointegration Test

Postby llenk01 » Thu Sep 03, 2015 10:01 am

Thanks for your help Trubador.

So in my case I use group "group1" instead the "x" in the suggested code..? weirdly I can run the program with "x" as well as "group1" but the x folder in my workfile is empy..

mode quiet
%y1 = "lnes"
%y2 = "lnfr"
group group1.add {%y2}
call greghansen({%y1},group1,4,"aic",6)
group1.drop {%y2}
'... [rest of the program]

My new results look much better. I used first country in each row as independent variable which I thought is the right think to do.. Would you suggest otherwise?
Attachments
NewResults.JPG
NewResults.JPG (158.91 KiB) Viewed 4874 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 Sep 03, 2015 1:14 pm

llenk01 wrote:So in my case I use group "group1" instead the "x" in the suggested code..? weirdly I can run the program with "x" as well as "group1" but the x folder in my workfile is empy..

That is because we empty the group after we are done. Otherwise it would keep adding new variables:

Code: Select all

group1.drop {%y2}

llenk01 wrote:I used first country in each row as independent variable which I thought is the right think to do.. Would you suggest otherwise?

Since this is a cointegration analysis, it should not matter. However, you can always try the other way around to see if there is a significant change in the results.

llenk01
Posts: 5
Joined: Sat Aug 29, 2015 5:41 am

Re: Gregory-Hansen Cointegration Test

Postby llenk01 » Fri Sep 04, 2015 2:55 am

Thanks again Trubador - I am really happy with the outcome and the results.

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

Re: Gregory-Hansen Cointegration Test

Postby nhuphuong114 » Thu Sep 10, 2015 12:54 am

Dear Mr. Trubador!

Plese kindly help me fix the error " Near Singular matrix error". Regressor maybe perfectly collinear in "DO_GHC.LS YC (@trend > 43-2)G". I attached my Work file and GH test code below.

Thank you in advance for your prompt attention! I'm looking forward to hearing from you soon!

Best Regards!
Phuong Ha
Attachments
gh test.prg
(4.79 KiB) Downloaded 152 times
phase iv.wf1
(30.36 KiB) Downloaded 151 times

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

Re: Gregory-Hansen Cointegration Test

Postby trubador » Fri Sep 11, 2015 3:16 am

One of your variables (lex) is causing the problem. There is nothing I can do about it.

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

Re: Gregory-Hansen Cointegration Test

Postby nhuphuong114 » Fri Sep 11, 2015 8:18 am

trubador wrote:One of your variables (lex) is causing the problem. There is nothing I can do about it.


Thank you for your advice! But when I remove the variable lex, this error still appears. Please kindly help me if removing the lex can make the GH test workable.

Best Regards!
Phuong Ha

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

Re: Gregory-Hansen Cointegration Test

Postby trubador » Sat Sep 12, 2015 10:31 am

You need to empty the group after you are done. See the previous thread: posting.php?mode=reply&f=15&t=976#pr45243

jug
Posts: 4
Joined: Thu Oct 29, 2015 1:53 am

Re: Gregory-Hansen Cointegration Test

Postby jug » Thu Oct 29, 2015 2:04 am

First of all, thank you for enabling GH cointegration test add-in for Eviews.

I just have one (fairly technical) question regarding break dates. Does the identified date refer to the last date of the old regime or the first date of the new regime?

I understand that Eviews generally (for instance for unit root tests with breakpoint) defines break date as the first date for the new regime. I was just wondering weather this is also the case for GH cointegration test?

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

Re: Gregory-Hansen Cointegration Test

Postby trubador » Fri Oct 30, 2015 5:16 am

First date of the new regime.

jug
Posts: 4
Joined: Thu Oct 29, 2015 1:53 am

Re: Gregory-Hansen Cointegration Test

Postby jug » Mon Nov 02, 2015 12:52 am

Thank you.

Cheers.


Return to “Program Repository”

Who is online

Users browsing this forum: No registered users and 2 guests