GVARResult.unit_columns#

GVARResult.unit_columns(unit)[source]#

Global column indices the named unit owns.

Parameters:

unit (str) – One of unit_names.

Return type:

tuple[int, ...]

Returns:

The contiguous run of global columns the unit’s variables occupy, which indexes names, endog, coefficients and every propagation array.

Raises:

SpecificationError – If the unit is unknown.

Example

>>> import numpy as np
>>> from cultivars.multivariate.reduced_form.vector_autoregression import VARX
>>> y = np.random.default_rng(0).standard_normal((200, 2))
>>> units = [VARX(y[:, [i]], y[:, [1 - i]], order=1).fit() for i in (0, 1)]
>>> swap = np.array([[0.0, 1.0], [1.0, 0.0]])
>>> names = ("us", "eu")
>>> res = GVAR(units, swap, variable_labels=["p", "p"], unit_names=names).solve()
>>> res.unit_columns("eu")
(1,)
>>> [res.names[c] for c in res.unit_columns("us")]
['us.p']