GVARResult.exogeneity_table#

GVARResult.exogeneity_table(*, alpha=0.05)[source]#

Run the weak-exogeneity test on every unit that supports it.

Units fitted in levels or at rank zero are skipped and named in a note rather than failing the table; a rejection anywhere puts a warning note first, because impulse responses from a system with a misspecified unit should not be read as they stand.

Parameters:

alpha (float) – Size of each test, used for the REJECT column and the rejection count.

Return type:

SummaryTable

Returns:

A SummaryTable with one row per foreign variable per tested unit, metadata counting units, tests and rejections, and the notes described above.

Example

>>> import numpy as np
>>> from cultivars.multivariate.reduced_form.error_correction import VECMX
>>> rng = np.random.default_rng(0)
>>> world, sat = np.zeros(400), np.zeros(400)
>>> for t in range(1, 400):
...     world[t] = world[t - 1] + rng.standard_normal()
...     gap = world[t - 1] - sat[t - 1]
...     sat[t] = sat[t - 1] + 0.3 * gap + 0.5 * rng.standard_normal()
>>> units = [
...     VECMX(world[:, None], sat[:, None], order=1, rank=1).fit(),
...     VECMX(sat[:, None], world[:, None], order=1, rank=1).fit(),
... ]
>>> swap = np.array([[0.0, 1.0], [1.0, 0.0]])
>>> names = ("world", "sat")
>>> res = GVAR(units, swap, variable_labels=["p", "p"], unit_names=names).solve()
>>> table = res.exogeneity_table()
>>> table.columns
('unit', 'foreign variable', 'statistic', 'df', 'p-value', '')
>>> [(row[0], row[-1]) for row in table.rows]
[('world', 'REJECT'), ('sat', '')]
>>> table.notes[0][:48]
"NOT WEAKLY EXOGENOUS at the 5% level: ('world',)"
>>> from cultivars.multivariate.reduced_form.vector_autoregression import VARX
>>> levels = VARX(world[:, None], sat[:, None], order=1, exog_order=1).fit()
>>> mixed = GVAR([levels, units[1]], swap, variable_labels=["p", "p"]).solve()
>>> mixed.exogeneity_table().metadata[1:3]
(('Tested', '1'), ('Rejections', '0'))
>>> mixed.exogeneity_table().notes[-1]
"Units fitted in levels and therefore untestable: ('unit1',)."