*! version 1.0.1 21aug2026

Title

gvar coint -- Johansen cointegration tests for every country model

Syntax

gvar coint [, options]

options

stat(string) trace or maxeig. Default trace.

set install the suggested ranks in the model.

rank(spec) impose ranks by hand, as rank(usa 2 euro 2).

nosummary suppress the table.

Description

gvar coint runs the Johansen trace and maximal-eigenvalue tests on each
VECMX*, using the critical values of Pesaran, Shin and Smith (2000) for
systems with I(1) weakly exogenous regressors. These are not the standard
Johansen critical values: they are indexed by the deterministic case, by
n - r, and by k, the number of weakly exogenous variables, and the
package ships the full table.

With set the suggested ranks are installed. The Toolbox writes
suggested ranks that the user is expected to review, and so does this.

Options

stat(trace|maxeig) which Johansen statistic. Default trace.

The two disagree often enough to matter. The trace test is generally the more
powerful against the alternative of one more relation; the maximal-eigenvalue
test is sharper when exactly one relation is in doubt. Where they disagree, the
rank is genuinely uncertain and neither answer should be adopted silently -- which
is the case for using set deliberately rather than by default.

rank(spec) imposes the rank by hand, globally or per unit, instead of
reading it off the test.

set writes the selected ranks into the model, so
gvar estimate uses them. Without it the command only
reports: the ranks in the model are unchanged.

Ranks chosen unit by unit will not in general reproduce someone else's published
model. gvar setup's spec() is how you fix the whole grid
at once, and it is the only reliable route to a replication.

graph plots each unit's statistic against its own critical value -- which
differs from row to row, because the Pesaran-Shin-Smith values depend on the
deterministic case, n-r and k.

name() names the graph; nosummary suppresses the report.

A unit whose (case, n-r, k) combination lies outside the shipped
critical-value table gets a missing rank and the command stops and names it.
It does not fall back on a fabricated zero.

Remarks

If a critical value is missing, the rank is missing. The published table
covers k up to 8. A unit with more weakly exogenous variables than that
has no tabulated critical value, and the command reports a missing rank and
refuses to continue rather than silently treating "no critical value" as "do
not reject", which would fabricate a rank of zero. If you hit this, either
reduce the foreign block or set the ranks by hand with rank().

Reviewing the suggestion. Ranks near the cut-off deserve a look at
gvar pp: a cointegrating relation whose persistence profile
does not settle back to zero is not a long-run relation, whatever the trace
statistic said. Overstated rank is the usual cause.

Examples

. gvar coint
. gvar coint, stat(maxeig)
. gvar coint, set
. gvar coint, rank(usa 2 euro 2 china 1)

Stored results

gvar coint stores the following in r():

r(coint) the test statistics

r(rank) the ranks, suggested or imposed

r(stat) which statistic was used

Source

Toolbox cointegration_test.m, get_rank.m; critical values from
Pesaran, Shin and Smith (2000), shipped as the critical-value table built into the engine.

Author

Dr Merwan Roudane

merwanroudane920@gmail.com

https://github.com/merwanroudane