How to specify a series range

For questions regarding programming in the EViews programming language.

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

startz
Non-normality and collinearity are NOT problems!
Posts: 3797
Joined: Wed Sep 17, 2008 2:25 pm

Re: How to specify a series range

Postby startz » Tue May 03, 2016 10:39 am

I don't think we know what you mean by "select specific observations."

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: How to specify a series range

Postby EViews Gareth » Tue May 03, 2016 10:48 am

You seem to be trying really really really hard to define different groups containing different rows of data, despite the fact that we keep telling you that you cannot do that, nor should you want to do that.

eviews1
Posts: 18
Joined: Mon May 02, 2016 8:55 am

Re: How to specify a series range

Postby eviews1 » Tue May 03, 2016 11:39 am

Yes I am still trying to find a way.

If that is not doable then how can I run multiple tests on sub-samples of the original sample (I need to run Johansen) .

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: How to specify a series range

Postby EViews Gareth » Tue May 03, 2016 11:55 am

Run the test on different samples. Just change the sample each time you want to run the test on a different set of observations.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: How to specify a series range

Postby EViews Gareth » Tue May 03, 2016 11:56 am

Perhaps to put it more concretely - a group let's you specify which variables (columns) to use, a sample let's you specify which observations (rows) to use.

eviews1
Posts: 18
Joined: Mon May 02, 2016 8:55 am

Re: How to specify a series range

Postby eviews1 » Tue May 03, 2016 12:42 pm

Richard Gareth,

I think I got what I tried to do. Please correct me if anything is not correctly described in my post.

Richard Gareth thank you for your comments.

Below I descibe the issue, post my code and the output snapshots ( I cannot post images so I pasted them in a different form):

The issue:
I have two original series with the range of observations from 1961 to 2014 (original series are can_x and us_x).
I need to run several Johansen cointegration tests on sub-samples of these two series.
In my code I run the first test on the 1961-2010 sub-sample of these series, then on the 1961-2011 sub-sample and etc. The last test is on the full sample 1961-2014.

The code
'Series of Johansen cointegration tests
for !i=2010 to 2014
smpl 1961 !i 'use specified range of observations
series can{!i}=can_x 'create the FIRST series with observations from original series bw 1961 !i
series us{!i}=us_x 'create the SECOND series with observations from original series bw 1961 !i
group can_x_us_x{!i} 'create a group
can_x_us_x{!i}.add can{!i} us{!i} 'add series to a group
freeze(table_johansen{!i}) can_x_us_x{!i}.coint(d, 1 2) 'run the Johansen cointegration test and save the result in a table
next

The output snapshots
It seems I cannot paste snapshots of the images. So I will post the in a different way
One of the groups that was created is can_x_us_x2010 (the 1961-2010 sub-sample):

CAN2010 US2010
1961 40.23010 59.31329
1962 39.65759 64.73793
1963 39.52341 67.33191
1964 40.47595 70.15734
1965 41.01585 71.93945
1966 41.58181 69.76717
1967 40.96461 65.35422
1968 48.22677 72.45433
1969 53.98952 86.71337
1970 49.00128 85.89440
1971 55.44427 91.19686
1972 69.40249 104.3501
1973 93.21668 142.0178
1974 92.19200 151.5040
1975 84.60903 145.8060
1976 100.2155 173.7112
1977 105.9243 182.1506
1978 122.3415 175.8367
1979 144.7247 260.0991
1980 133.5456 232.9298
1981 123.7870 203.1993
1982 116.2240 208.6313
1983 129.4837 202.0438
1984 120.9553 195.3894
1985 119.0767 206.2941
1986 128.6462 200.2189
1987 145.6785 205.3843
1988 145.7084 207.7586
1989 157.6146 245.9707
1990 168.4288 210.9880
1991 169.1397 266.3293
1992 186.2734 335.9873
1993 230.0347 352.2377
1994 249.3754 376.2445
1995 223.7546 388.1790
1996 248.4050 385.6480
1997 262.7686 361.9370
1998 220.5325 330.2682
1999 244.4951 352.0364
2000 221.4703 345.3320
2001 202.4190 320.6183
2002 183.4195 273.2831
2003 164.8000 249.4591
2004 213.0484 326.8864
2005 205.5161 354.0835
2006 204.0889 398.8202
2007 204.1757 405.2221
2008 202.5210 396.5033
2009 177.2606 360.9773
2010 214.9897 373.3097
2011 NA NA
2012 NA NA
2013 NA NA
2014 NA NA

The Johansen cointegration test ran on that sub-sample was stored in a table table_johansen2010 (the adjusted sample is 1964-2010 as I chose 1 2 lags
Date: 05/03/16 Time: 15:26
Sample (adjusted): 1964 2010
Included observations: 47 after adjustments
Trend assumption: Linear deterministic trend (restricted)
Series: CAN2010 US2010
Lags interval (in first differences): 1 to 2

Unrestricted Cointegration Rank Test (Trace)

Hypothesized Trace 0.05
No. of CE(s) Eigenvalue Statistic Critical Value Prob.**

None 0.247540 15.46846 25.87211 0.5358
At most 1 0.043724 2.101299 12.51798 0.9621

Trace test indicates no cointegration at the 0.05 level
* denotes rejection of the hypothesis at the 0.05 level
**MacKinnon-Haug-Michelis (1999) p-values

Unrestricted Cointegration Rank Test (Maximum Eigenvalue)

Hypothesized Max-Eigen 0.05
No. of CE(s) Eigenvalue Statistic Critical Value Prob.**

None 0.247540 13.36716 19.38704 0.2993
At most 1 0.043724 2.101299 12.51798 0.9621

Max-eigenvalue test indicates no cointegration at the 0.05 level
* denotes rejection of the hypothesis at the 0.05 level
**MacKinnon-Haug-Michelis (1999) p-values

Unrestricted Cointegrating Coefficients (normalized by b'*S11*b=I):

CAN2010 US2010 @TREND(62)
0.026770 -0.043135 0.215033
-0.035846 0.011618 0.017619


Unrestricted Adjustment Coefficients (alpha):

D(CAN2010) 2.423366 3.419422
D(US2010) 12.23783 2.414355


1 Cointegrating Equation(s): Log likelihood -401.4782

Normalized cointegrating coefficients (standard error in parentheses)
CAN2010 US2010 @TREND(62)
1.000000 -1.611308 8.032525
(0.29945) (2.39317)

Adjustment coefficients (standard error in parentheses)
D(CAN2010) 0.064874
(0.07061)
D(US2010) 0.327610
(0.10143)

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: How to specify a series range

Postby EViews Gareth » Tue May 03, 2016 1:22 pm

Code: Select all

'Series of Johansen cointegration tests for !i=2010 to 2014 smpl 1961 !i 'use specified range of observations series can{!i}=can_x 'create the FIRST series with observations from original series bw 1961 !i series us{!i}=us_x 'create the SECOND series with observations from original series bw 1961 !i group can_x_us_x{!i} 'create a group can_x_us_x{!i}.add can{!i} us{!i} 'add series to a group freeze(table_johansen{!i}) can_x_us_x{!i}.coint(d, 1 2) 'run the Johansen cointegration test and save the result in a table next
This code is redundant. All you need to do is this:

Code: Select all

group can_x_us_x can_x us_x for !i=2010 to 2014 smpl 1961 !i freeze(table_johansen{!i}) can_x_us_x.coint(d,1,2) next
As we kept telling you, all you have to do is change the sample each time you want to run the analysis, whether it is a regression or a cointegration test, or a unit root test, or a histogram or whatever, you just need to change the sample. There is no need to change the group.

eviews1
Posts: 18
Joined: Mon May 02, 2016 8:55 am

Re: How to specify a series range

Postby eviews1 » Wed May 04, 2016 12:46 pm

Hello Gareth,

Thank you very much for your feedback. It is very helpful.

Yes my code is redundant though it produced the same result. It was my first Eviews code. I realized now your yesterday's post.

Regards,

Argyn


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests