FunctionalCoefficientVARResult.coefficient_curve#

FunctionalCoefficientVARResult.coefficient_curve(equation, regressor)[source]#

One coefficient’s estimated curve over the state grid.

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

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

Return type:

NDArray[double]

Returns:

A (G, 3) array with columns (low, point, high), the band one pointwise standard error each side – conditional on the bandwidth, so read it as precision at this smoothing, not as inference over smoothings.

Raises:

SpecificationError – If the equation or regressor is unknown.

Example

>>> import numpy as np
>>> rng = np.random.default_rng(0)
>>> y = np.zeros((250, 2))
>>> for t in range(1, 250):
...     a = 0.8 * np.tanh(y[t - 1, 0])
...     y[t, 0] = a * y[t - 1, 0] + 0.5 * rng.standard_normal()
...     y[t, 1] = 0.4 * y[t - 1, 1] + 0.5 * rng.standard_normal()
>>> res = FunctionalCoefficientVAR(y, order=1, transition_variable="y1").fit(
...     bandwidth=1.2, n_grid=21
... )
>>> curve = res.coefficient_curve("y1", "y1.L1")
>>> curve.shape, bool(np.all(curve[:, 0] < curve[:, 1]))
((21, 3), True)
>>> bool(np.all(curve[:, 1] < curve[:, 2]))
True
>>> bool(np.allclose(curve[:, 1], res.curves[:, 1, 0]))
True
>>> res.coefficient_curve("y1", "y1.L2")
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: unknown regressor 'y1.L2'; expected one of ...