TVPVARResult.coefficient_path#

TVPVARResult.coefficient_path(equation, regressor)[source]#

One coefficient’s posterior path: 16th percentile, mean, 84th.

Parameters:
  • equation (str) – An endogenous variable.

  • regressor (str) – A per-equation regressor label – "const", "trend", or "{name}.L{lag}".

Return type:

NDArray[double]

Returns:

An (nobs, 3) array with columns (low, mean, high).

Raises:

SpecificationError – If the equation or regressor is unknown.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> y = np.zeros((140, 2))
>>> for t in range(1, 140):
...     y[t] = 0.5 * y[t - 1] + rng.standard_normal(2)
>>> res = TVPVAR(y, order=1, training=40).fit(n_draws=40, n_burn=15, seed=0)
>>> path = res.coefficient_path("y2", "y1.L1")
>>> path.shape, bool(np.all(path[:, 0] <= path[:, 1]))
((99, 3), True)
>>> bool(np.all(path[:, 1] <= path[:, 2]))
True
>>> bool(np.allclose(path[:, 1], res.beta_mean[:, res._width + 1]))
True
>>> res.coefficient_path("y1", "y1.L2")
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: unknown regressor 'y1.L2'; expected one of ...