You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason I am worried about the timing is that Kalman.update(y) appears to call both prior_to_filtered(y) and filtered_to_forecast(), according to the QuantEcon documentation:
defupdate(self, y):
""" Updates x_hat and Sigma given k x 1 ndarray y. The full update, from one period to the next Parameters ---------- y : np.ndarray A k x 1 ndarray y representing the current measurement """self.prior_to_filtered(y)
self.filtered_to_forecast()
Since filtered_to_forecast() advances the filtering distribution to the next predictive distribution, kn.x_hat after kn.update(y[:, t]) seems to represent the next prior rather than the prediction being compared with $x_t$.
If that is right, then diff1 is comparing $x_t$ with a one-period-ahead object.
Would it be more consistent with the exercise to update the filter using the previous observation before comparing with $x_t$, e.g.
Activity
jstac commentedon Jun 6, 2026
Hi @longye-tian , good catch! Yes, please put up a PR with a fix.
Much appreciated!