MFVAR.from_result#

classmethod MFVAR.from_result(result, *, kinds, period, weights=None)[source]#

Build a filter from an already-estimated high-frequency VAR.

The intended workflow. Estimate the VAR on whatever high-frequency sample exists – a shorter span, a related vintage, a subset of the variables – then bring those parameters here to infer the latent path over the mixed-frequency sample.

Parameters:
  • result (object) – Any fitted result exposing coefficients, sigma_u, and names.

  • kinds (Sequence[Literal['high', 'stock', 'flow']]) – One Frequency per variable.

  • period (int) – High-frequency sub-periods per low-frequency period.

  • weights (Sequence[ArrayLike | None] | None) – Optional per-variable sub-period weights.

Return type:

Self

Returns:

A configured MFVAR.

Raises:

SpecificationError – If result lacks the required attributes.

Note

The result’s deterministic block is not carried over, so the filter runs without an intercept even when the VAR was fitted with one; pass intercept to the constructor directly when the level matters for the nowcast.

Example

>>> import numpy as np
>>> from cultivars.multivariate.reduced_form.vector_autoregression import VAR
>>> rng = np.random.default_rng(0)
>>> z = np.zeros((200, 2))
>>> for t in range(1, 200):
...     z[t] = [[0.5, 0.2], [0.1, 0.6]] @ z[t - 1] + rng.standard_normal(2)
>>> fitted = VAR(z, order=1).fit()
>>> model = MFVAR.from_result(fitted, kinds=["high", "flow"], period=3)
>>> model.order, model.k_endog
(1, 2)
>>> MFVAR.from_result(object(), kinds=["high", "flow"], period=3)
Traceback (most recent call last):
cultivars.exceptions.SpecificationError: result does not expose ['coefficients', ...