Dear Allin,

I am totally new in the list and I don't know if you have access to my first message. Assuming that you haven't, I am resending it now.

Dear all,

I am writing because I am facing discrepancies between the outputs of the Johansen cointegration tests in Gretl and R. Concretely, both softwares yield exactly the same test statistics, but the critical values are different (therefore, the decision about the number of cointegration vectors not always coincide). Attached is a data with 62 yearly observations where the two first columns are treated as endogenous variables (GDP and NDB) and the last is a dummy variable treated as exogenous. I don't include restricted drift.

In the window of the Johansen cointegration test I selected lag order 6; GDP and NDB in Variables to test; bnprivatefinancingdummy in Exogenous variables (Unrestricted) and at the botton Unrestricted constant. And the output is,

Johansen test:

Number of equations = 2

Lag order = 6

Estimation period: 1959 - 2014 (T = 56)

Case 3: Unrestricted constant

Exogenous regressor(s): bnprivatefinancingdummy

Number of equations = 2

Lag order = 6

Estimation period: 1959 - 2014 (T = 56)

Case 3: Unrestricted constant

Exogenous regressor(s): bnprivatefinancingdummy

Log-likelihood = 280.81 (including constant term: 121.889)

Cointegration tests, ignoring exogenous variables

Rank Eigenvalue Trace test p-value Lmax test p-value

0 0.30870 26.346 [0.0006] 20.674 [0.0033]

1 0.096321 5.6718 [0.0172] 5.6718 [0.0172]

Rank Eigenvalue Trace test p-value Lmax test p-value

0 0.30870 26.346 [0.0006] 20.674 [0.0033]

1 0.096321 5.6718 [0.0172] 5.6718 [0.0172]

Corrected for sample size (df = 42)

Rank Trace test p-value

0 26.346 [0.0008]

1 5.6718 [0.0210]

Rank Trace test p-value

0 26.346 [0.0008]

1 5.6718 [0.0210]

Note: in general, the test statistics above are valid only in the

absence of additional regressors.

absence of additional regressors.

eigenvalue 0.30870 0.096321

beta (cointegrating vectors)

baGDP -13.181 -9.6509

bdNDB 2.6539 3.3911

baGDP -13.181 -9.6509

bdNDB 2.6539 3.3911

alpha (adjustment vectors)

baGDP 0.015526 -0.0053853

bdNDB -0.046274 -0.077268

baGDP 0.015526 -0.0053853

bdNDB -0.046274 -0.077268

renormalized beta

baGDP 1.0000 -2.8460

bdNDB -0.20135 1.0000

baGDP 1.0000 -2.8460

bdNDB -0.20135 1.0000

renormalized alpha

baGDP -0.20465 -0.018262

bdNDB 0.60993 -0.26202

baGDP -0.20465 -0.018262

bdNDB 0.60993 -0.26202

long-run matrix (alpha * beta')

baGDP bdNDB

baGDP -0.15267 0.022943

bdNDB 1.3556 -0.38483

baGDP bdNDB

baGDP -0.15267 0.022943

bdNDB 1.3556 -0.38483

I guess most of you are familiar with R. In R the code is the following:

johansen<-ca.jo(data[1:2], type = "trace", ecdet = "none", K = 6, spec = "longrun", dumvar = data[3])

summary(johansen)

summary(johansen)

And the output is this,

###################### # Johansen-Procedure # ###################### Test type: trace statistic , with linear trend Eigenvalues (lambda): [1] 0.30869583 0.09632144 Values of teststatistic and critical values of test: test 10pct 5pct 1pct r <= 1 | 5.67 6.50 8.18 11.65 r = 0 | 26.35 15.66 17.95 23.52 Eigenvectors, normalised to first column: (These are the cointegration relations) baGDP.l6 bdNDB.l6 baGDP.l6 1.0000000 1.0000000 bdNDB.l6 -0.2013471 -0.3513728 Weights W: (This is the loading matrix) baGDP.l6 bdNDB.l6 baGDP.d -0.2046459 0.05197298 bdNDB.d 0.6099287 0.74570305

As you can see and as I mentioned before, the test statistics is the same, but the critical values (p-values) differ significantly. And this discrepancy in the critical values (and p-values) has been persistent in the case of other cointegration tests using other series. In this example, R indicates one cointegration vector and Gretl two cointegration vectors (at 5% of significance).

Please, can you tell me why there is the discrepancy?

Kind regards,

Reynaldo Senra

On Fri, 1 Feb 2019, Sven Schreiber wrote:

> OK, so gretl and the tsDyn package for R seem to agree about the

> p-values [...]

Here's a replication and extension of Sven's exercise. It's not

trivial to get R's tsDyn and urca packages to perform the same test

but I think I've succeeded. Note that using

include="const"

in tsDyn is equivalent to

ecdet="none"

in urca.

<hansl>

open denmark

coint2 4 LRM LRY --quiet

foreign language=R --send-data

require(tsDyn)

cidat <- gretldata[,1:2] # again LRM LRY

ve <- VECM(cidat, lag=3, estim="ML", include="const")

ve_test0 <- rank.test(ve, r_null=0, type="trace")

ve_test0

ve_test1 <- rank.test(ve, r_null=1, type="trace")

ve_test1

require(urca)

test2 <- ca.jo(cidat, type="trace", K=4, ecdet=c("none"))

summary(test2)

end foreign

</hansl>

The relevant portions of the output:

---------------------------

gretl (omitting the presumably more reliable small-sample p-values

that gretl provides):

Rank Eigenvalue Trace test p-value Lmax test p-value

0 0.19415 11.904 [0.1633] 11.009 [0.1557]

1 0.017402 0.89533 [0.3440] 0.89533 [0.3440]

R, tsDyn:

Test of rank 0 versus 2 (trace test), p-value: 0.1633226.

Test of rank 1 versus 2 (trace test), p-value: 0.344037.

R, urca:

Test type: trace statistic , with linear trend

Values of teststatistic and critical values of test:

test 10pct 5pct 1pct

r <= 1 | 0.9 6.50 8.18 11.65

r = 0 | 11.9 15.66 17.95 23.52

---------------------------

Gretl and tsDyn are clearly agreed. What about urca? Note that the

two tests appear in the opposite order relative to gretl and tsDyn.

a) Since "test" = 0.9 is less than "10pct" = 6.50, H0 is not

rejected at the 10% level. Agreed, since gretl and tsDyn show

p-value = 0.344.

b) Since "test" = 11.9 is less than "10pct" = 15.66, H0 is not

rejected at the 10% level. Agreed, since gretl and tsDyn show

p-value = 0.1633.

So I think we await a fully-specified example of disagreement

between R::urca and R::tsDyn or gretl.

Allin

_______________________________________________

Gretl-users mailing list

Gretl-users@lists.wfu.edu

http://lists.wfu.edu/mailman/listinfo/gretl-users

> OK, so gretl and the tsDyn package for R seem to agree about the

> p-values [...]

Here's a replication and extension of Sven's exercise. It's not

trivial to get R's tsDyn and urca packages to perform the same test

but I think I've succeeded. Note that using

include="const"

in tsDyn is equivalent to

ecdet="none"

in urca.

<hansl>

open denmark

coint2 4 LRM LRY --quiet

foreign language=R --send-data

require(tsDyn)

cidat <- gretldata[,1:2] # again LRM LRY

ve <- VECM(cidat, lag=3, estim="ML", include="const")

ve_test0 <- rank.test(ve, r_null=0, type="trace")

ve_test0

ve_test1 <- rank.test(ve, r_null=1, type="trace")

ve_test1

require(urca)

test2 <- ca.jo(cidat, type="trace", K=4, ecdet=c("none"))

summary(test2)

end foreign

</hansl>

The relevant portions of the output:

---------------------------

gretl (omitting the presumably more reliable small-sample p-values

that gretl provides):

Rank Eigenvalue Trace test p-value Lmax test p-value

0 0.19415 11.904 [0.1633] 11.009 [0.1557]

1 0.017402 0.89533 [0.3440] 0.89533 [0.3440]

R, tsDyn:

Test of rank 0 versus 2 (trace test), p-value: 0.1633226.

Test of rank 1 versus 2 (trace test), p-value: 0.344037.

R, urca:

Test type: trace statistic , with linear trend

Values of teststatistic and critical values of test:

test 10pct 5pct 1pct

r <= 1 | 0.9 6.50 8.18 11.65

r = 0 | 11.9 15.66 17.95 23.52

---------------------------

Gretl and tsDyn are clearly agreed. What about urca? Note that the

two tests appear in the opposite order relative to gretl and tsDyn.

a) Since "test" = 0.9 is less than "10pct" = 6.50, H0 is not

rejected at the 10% level. Agreed, since gretl and tsDyn show

p-value = 0.344.

b) Since "test" = 11.9 is less than "10pct" = 15.66, H0 is not

rejected at the 10% level. Agreed, since gretl and tsDyn show

p-value = 0.1633.

So I think we await a fully-specified example of disagreement

between R::urca and R::tsDyn or gretl.

Allin

_______________________________________________

Gretl-users mailing list

Gretl-users@lists.wfu.edu

http://lists.wfu.edu/mailman/listinfo/gretl-users