TVPSVAR#

class cultivars.multivariate.nonlinear.time_varying.TVPSVAR(source, *, order=None)[source]#

Recursive structural interpretation of a fitted TVP-VAR, per date.

Not an _IdentificationModel: a drifting system is a continuum of closed systems, one per date, and what this class packages is the path of identifications under a single recursive declaration.

The declaration works differently across the two reduced forms, and the difference is enforced rather than papered over. For the homoskedastic model the ordering is applied here, to the posterior mean covariance, and any permutation of names is admissible. For the SV model the triangular factorization was the estimation: A and the volatility paths were drawn in the order of names, so the ordering was declared when the model was fitted, and asking for a different one here is asking for a different fitted model – refit with the columns reordered.

Variables:
  • _source – The fitted reduced-form result.

  • _order – The requested recursive ordering, or None for the order of names.

Parameters:
Raises:

SpecificationError – If the source is not a fitted TVP result, an ordering is requested for an SV source, or the ordering is not a permutation of names.

See also

  • TVPSVARResult – the record identify returns.

  • Recursive – the same declaration on a constant-coefficient system.

References

Primiceri, G. E. (2005). Time varying structural vector autoregressions and monetary policy. Review of Economic Studies, 72(3), 821-852.

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)
>>> svar = TVPSVAR(res).identify()
>>> svar.irf(4, t=50).shape
(5, 2, 2)
>>> TVPSVAR(y)
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: TVPSVAR constructs with a fitted ...
>>> TVPSVAR(res, order=("y2", "y3"))
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: order must be a permutation of ('y1', 'y2'); ...

Methods#

identify()

Assemble the impact path under the recursive declaration.