Gregory-Hansen Cointegration Test

For posting your own programs to share with others

Moderators: EViews Gareth, EViews Moderator

d952
Posts: 64
Joined: Tue Nov 22, 2011 6:30 am

Re: Gregory-Hansen Cointegration Test

Postby d952 » Thu Feb 27, 2014 7:03 am

Hi Trabadur, would you please tell me in this test number of observation matter? for example my data sample contains 5000 observations, can I use Gregory and Hansen test?
Thank you in advance

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

Re: Gregory-Hansen Cointegration Test

Postby trubador » Thu Feb 27, 2014 1:57 pm

I cannot think of any particular reason why the test should not be used in such large samples. But if this is a high frequency data (daily/intraday), then the noise may introduce problems and some sort of filtering may be needed prior to the analysis. A literature review might be helpful in that respect...

mensenu
Posts: 2
Joined: Tue Apr 22, 2014 3:48 am

Re: Gregory-Hansen Cointegration Test

Postby mensenu » Fri Apr 25, 2014 6:26 am

Hello,

Could someone help me please? I uploaded the files. Error: "Near Singular Matrix in "Do_ghc.ls Y C (@trend>35-2) G"
This error occurs when I run the program under the regime shift.

thanks in advance!

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

Re: Gregory-Hansen Cointegration Test

Postby trubador » Fri Apr 25, 2014 2:16 pm

One of the earlier posts does address this problem. Your independent variable contains zeros until 9/25/2006, which is the very source of the error. You should adjust the range accordingly. Please inspect the raw data carefully before doing anything with them.

mensenu
Posts: 2
Joined: Tue Apr 22, 2014 3:48 am

Re: Gregory-Hansen Cointegration Test

Postby mensenu » Fri Apr 25, 2014 10:35 pm

thanks Trubador!

Does it happen all the time? What if the data don't have those values?

And does it still recognize as "NA" if I input zero instead of NA?

Thanks again!

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

Re: Gregory-Hansen Cointegration Test

Postby trubador » Sat Apr 26, 2014 2:43 am

Actually, that post explains the situation for NA values. And yes, it applies to zero values as well. The problem here is related to your data, not the specification itself.

mahwish_arshad
Posts: 2
Joined: Fri Jun 27, 2014 8:13 am

Re: Gregory-Hansen Cointegration Test

Postby mahwish_arshad » Thu Jul 03, 2014 6:04 am

trubador wrote:Actually, that post explains the situation for NA values. And yes, it applies to zero values as well. The problem here is related to your data, not the specification itself.


Hi turbador thanks for helpful posts. I have a question regarding your above post. If there is no NA value in data set and error message occurs "Near Singular Matrix error. Regressors may be perfectly collinear in "Do_GHC.LS Y C (@TREND>5-2) G" then what does it mean? is there multicollinearity among regressors?

addienasyamila
Posts: 8
Joined: Sat Nov 01, 2014 6:07 am

Re: Gregory-Hansen Cointegration Test

Postby addienasyamila » Sat Nov 01, 2014 6:43 am

dear trubador,

i really need your help. i want to know how to run gregory hansen cointegration test. i hope u explain to me with detail. could i know your email so that i can contact you directly. thanks :)

addienasyamila
Posts: 8
Joined: Sat Nov 01, 2014 6:07 am

Re: Gregory-Hansen Cointegration Test

Postby addienasyamila » Tue Nov 04, 2014 8:12 am

what maxlag i have to write in gregory hansen subroutine? is that based on our own? and how to interpret the result (beased on ADF procedure and phillip procedure)? thankyou for your help :)

addienasyamila
Posts: 8
Joined: Sat Nov 01, 2014 6:07 am

Re: Gregory-Hansen Cointegration Test

Postby addienasyamila » Tue Nov 04, 2014 6:01 pm

dear trubador,
i've time series data and i think have a trend. how to intrepret the result of gregory hansen test? which model would we choose what procedure i must based to? i really hope your reply:)

THE GREGORY-HANSEN
COINTEGRATION TEST
MODEL 2: Level Shift

Model A. with level shift (c)
ADF Procedure

t-stat -2.843375
Lag 0.000000
Break 2010M02

Phillips Procedure

Za-stat -16.13550
Za-break 2010M02
Zt-stat -3.014790
Zt-break 2010M02


Model B. level shift with trend
THE GREGORY-HANSEN
COINTEGRATION TEST
MODEL 3: Level Shift with Trend

ADF Procedure

t-stat -3.455989
Lag 1.000000
Break 2007M04

Phillips Procedure

Za-stat -21.67565
Za-break 2007M03
Zt-stat -3.032055
Zt-break 2007M03


Model c. regime shift
THE GREGORY-HANSEN
COINTEGRATION TEST
MODEL 4: Regime Shift

ADF Procedure

t-stat -2.815224
Lag 1.000000
Break 2011M02

Phillips Procedure

Za-stat -15.07875
Za-break 2010M08
Zt-stat -2.861866
Zt-break 2010M08
Attachments
test.WF1
(18.04 KiB) Downloaded 755 times

dilzod1
Posts: 1
Joined: Sun Jan 18, 2015 6:37 am

Re: Gregory-Hansen Cointegration Test

Postby dilzod1 » Sun Jan 18, 2015 6:52 am

Hello guys,

I have some questions regarding cointegration tests. I will appreciate very much if you take time and help me with this.
I have price index data of several countries and Dow Jones (DJ).
I need find whether these countries are cointegrated with DJ.
I have already run the test separately. (E.g. test on Mexico with DJ, Greece with DJ, etc.)
Now I need to make portfolio of these countries. How can I form a portfolio of these countries under Gregory-Hansen Test and Johansen cointegration test?

Thanks in advance!

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

Re: Gregory-Hansen Cointegration Test

Postby nhuphuong114 » Sat May 23, 2015 10:11 pm

Dear Trubador!

This is the first time I run in Eviews by using code. I did following to your guide, but an error appears :"flow of control Statement executed from the command line".
Attached is my Work file. Please kindly you help me fix this error!
I started the procedure such as:
group independents
independents.add loil lex
call greghansen(lsen,independents,4,"aic",2)
.....
Thank you so much and best regards!
Phuong Ha
Attachments
official data 2005-2015.wf1
(169.15 KiB) Downloaded 591 times

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

Re: Gregory-Hansen Cointegration Test

Postby trubador » Mon May 25, 2015 2:08 am

Reading through previous discussions (at least) would be more than helpful: viewtopic.php?f=15&t=976#p4932

As the error message indicates, you trying to run a program code from the command line...

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

Re: Gregory-Hansen Cointegration Test

Postby feka » Mon May 25, 2015 10:08 pm

dear trubador,

Thank you for generating greghansen test code for eviews. I am new to econometrics and I am trying to use this code for my project. however I get the error message: "!type mismatch at argument 2 in "call greghansen(x,y,2,"aic",6)" whenever i run the code. I have search in the previous posts and found that this question apparently had been asked in 2010 but it seems no answers avalaible.

Could you please help me to resolve the problem. Below I attach the workfile and the program.
thank you very much for your time and assistance.
Attachments
greghansen.prg
(5.46 KiB) Downloaded 641 times
xm lao.WF1
(12.82 KiB) Downloaded 565 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:00 am

feka wrote:I get the error message: "!type mismatch at argument 2 in "call greghansen(x,y,2,"aic",6)" whenever i run the code. I have search in the previous posts and found that this question apparently had been asked in 2010 but it seems no answers avalaible.

See the "Arguments" section in the code. It says, the second argument should be a group even if you have only one series. Creating a group object with a single series should solve your problem.


Return to “Program Repository”

Who is online

Users browsing this forum: No registered users and 13 guests