*! version 1.0.1 21aug2026

Title

gvar wetest -- test the weak exogeneity of the foreign variables

Syntax

gvar wetest [, ls(#) ln(#) level(#) nosummary saving(name)]

options

ls(#) lagged differences of the domestic variables in the marginal model. Default 1.

ln(#) lagged differences of the foreign variables. Default 1.

select(aic|sbc) choose ls() and ln() per unit by that criterion instead.

maxls(#) maximum domestic order searched by select(). Default 2.

maxln(#) maximum foreign order searched by select(). Default 2.

weforeign(varlist) add these variables' foreign counterparts to the marginal model. Default none.

level(#) level for the critical value. Default 95.

nosummary suppress the table.

saving(name) save the results matrix.

Description

gvar wetest runs the F test of Dees, di Mauro, Pesaran and Smith (2007)
for each unit and each of its weakly exogenous variables. A marginal model is
fitted for the first difference of the foreign variable on a constant, the
error-correction terms of that unit's own model, and lagged differences of
its domestic and foreign variables. The null is that the error-correction
terms do not enter.

This is the assumption the whole country-by-country estimation rests on. If
the foreign variables are not weakly exogenous, the VECMX* estimates are not
consistent for the long-run parameters.

Options

ls(#) and ln(#) the lag orders in the auxiliary regression: the lags
of the foreign variables and of the error-correction terms. Both default to 1.

weforeign(varlist) adds the foreign counterparts of these domestic
variables to the marginal model's regressor block, where the unit does not
already carry them. A global variable name adds the series itself, and is
ignored for any unit holding it endogenous. The left-hand side is untouched, so
the shape of the table does not change.

The Toolbox specifies this block separately from the country model's weakly
exogenous block (fvflag_we / gvflag_we, gvar.m:1680-1714) and
pauses to let you edit it; the default there, and here, is to leave it equal to
the estimation block. Its note at that pause offers weforeign(ep) for
DdPS(2007), but that is not what the shipped demo's published
exogeneity_test sheet was run with -- it changes the degrees of freedom
away from the published ones. See
gvar methods, "Weak exogeneity: a known deviation".

level(#) the significance level for the reported critical value. Default
95.

graph, name(), saving() and nosummary as elsewhere.

How to read the result. Weak exogeneity is the assumption the whole
country-by-country estimation rests on: it is what allows each VECMX* to be
fitted conditional on x* without modelling the rest of the world. A rejection
for a few (unit, variable) pairs out of many is expected at any level -- roughly
5 to 10% of tests on a correctly specified GVAR. A rejection concentrated in one
unit, or in one variable across many units, is the one worth investigating.

A test that could not be computed is reported as such rather than dropped. That is
a failure of the auxiliary regression, not a specification fact, and the two
should not look alike in a table.

Remarks

Against the Toolbox demo. This command reproduces
test_weakexogeneity.m's formula, restriction count and degrees of freedom
(24 of 26 units, and the same 24 critical values exactly), and 96.1% of the 5%
verdicts on the shipped demo -- but not the F levels on its published
exogeneity_test sheet, none of which agree to 1e-6. Read the rejection
pattern rather than individual F values, and do not quote them against the
Toolbox's. The full account, including what has been ruled out, is in
gvar methods, "Weak exogeneity: a known deviation".

What a normal result looks like. Dees, di Mauro, Pesaran and Smith
report rejection rates of roughly 5 to 10 per cent for a correctly specified
GVAR. The shipped demo rejects 18 of 203, or 8.9 per cent, which is in that
range. A much higher rate is evidence against the specification, not a
curiosity.

A dash is not a failure; a dot is. The table carries one column per weakly
exogenous variable across the whole model, and most units do not have all of
them, so the grid is necessarily sparse.

- the variable is not in that unit's block -- a fact about
the specification

. the variable IS in the block but no F could be
computed -- a failure

The two used to print as the same dot, which made a 25-row column of structural
blanks under ep* look identical to 25 broken tests. They are now distinct
and the footer counts the second kind; on the shipped demo that count is zero.

Why ep* is a dash for 25 of 26 units: only the USA has a foreign exchange
rate, every other country holding its own ep as a domestic variable. And
the USA's own row is dashes except under y*, Dp* and ep*, because
its foreign block is deliberately just those three. Both patterns are the
Dees-di Mauro-Pesaran-Smith convention and both match the Toolbox's own
exogeneity_test sheet cell for cell.

The critical value varies by unit, because it depends on the
cointegrating rank. It is reported in the last column rather than assumed.

Examples

. gvar wetest
. gvar wetest, ls(1) ln(1)
. gvar wetest, saving(WE)

Stored results

gvar wetest stores the following in r():

r(wetest) the F statistics and critical values

r(nrej) rejections at the chosen level

r(ntot) tests computed

r(nmiss) tests that should have been computable but were not

Source

Toolbox test_weakexogeneity.m, select_lags_we.m.

Author

Dr Merwan Roudane

merwanroudane920@gmail.com

https://github.com/merwanroudane