MFVAR.filter#

MFVAR.filter(endog)[source]#

Run the forward pass over the mixed-frequency sample.

The one-sided estimate: each period’s state uses readings up to that period only, which is what a real-time nowcast at that date would have had.

Parameters:

endog (ArrayLike) – The (nobs, k) sample at the high frequency, nan wherever a variable is not observed.

Return type:

_KalmanFilterResult

Returns:

The Kalman filter output over the stacked state, whose first k state columns are the current latent vector.

Example

>>> import numpy as np
>>> A, S = np.array([[[0.5, 0.1], [0.0, 0.4]]]), np.eye(2)
>>> y = np.full((24, 2), np.nan)
>>> rng = np.random.default_rng(0)
>>> y[:, 0], y[2::3, 1] = rng.standard_normal(24), rng.standard_normal(8)
>>> model = MFVAR(A, S, kinds=["high", "flow"], period=3)
>>> filtered = model.filter(y)
>>> filtered.filtered_state.shape, filtered.filtered_state_cov.shape
((24, 6), (24, 6, 6))
>>> bool(np.isclose(filtered.loglikelihood, model.smooth(y).loglikelihood))
True