Repository navigation
Description
Hi @jstac,
I noticed a few points in section 3 and 4 of kalman_2 lecture that might be worth clarifying.
Section 3 A state-space representation
-
The displayed observation equation seems to use
$G = [g \quad 0]$ , so that output depends on human capital but not directly on effort. In the code, however, we currently setG = np.array([g, 1])
Is this meant to be
np.array([g, 0]), or should the text explain why effort enters the observation equation directly? -
The covariance matrix
$\Sigma_0$ uses$\sigma_{h,0}$ and$\sigma_{u,0}$ as entries. It might be helpful to clarify whether these symbols denote variances or standard deviations. -
The simulated
LinearStateSpaceobject is created withSigma_0=np.zeros((2,2)), even though the model has just defined a non-degenerate initial covariance matrix$\Sigma_0$ . If this is intentional, perhaps we could add a sentence explaining that the simulation fixes a particular worker's initial state, while the firm still begins with uncertain beliefs about that worker. -
There is a small typo:
we first we createcould be changed towe first create.
Section 4 An Innovations Representation
-
The title could perhaps use sentence case:
An innovations representation. -
After introducing the innovation equation, it might help to define
$a_t$ explicitly, for example as the innovation / forecast error:$$a_t = y_t - G \hat x_t$$ -
The code calls
kalman.update(y[t])
before recording
x_hatandΣ. Sincekalman.update(y[t])incorporates the current observationy[t]and then advances the filter to the next predictive state, the recordedx_hatdoes not seem to correspond to the pre-observation belief$\hat x_t = \mathbb{E}[x_t \mid y^{t-1}]$ described in the text. If the plots are meant to show the firm's belief before observing current output$y_t$ , perhaps the code should record the current prediction first and then callkalman.update(y[t]). -
Relatedly, the loop uses
range(1, T), which starts the Kalman-filter loop att = 1, so the first simulated observationy[0]is not passed tokalman.update. If the firm is meant to observe output from time 0 onward, it would be helpful to clarify whethery[0]is intentionally skipped, or whether the update loop should start att = 0. -
The code prepends
x[:, 1]tox_hat_t, even thoughxis the simulated true hidden state. Sincex_hat_totherwise seems to represent filtered / predicted estimates, it might be clearer to avoid mixing in the true state, or to explain why this is being done. -
The covariance array prepends
worker.Σ_0, while the state-estimate array prepends the true simulated state. It might be clearer if both initial entries represented the same object, either the firm's prior belief or the realized worker state. -
The text switches between
$u_0$ and$u_t$ in the inference labels. Since$u_t = u_0$ , this is not mathematically wrong, but using one notation consistently might be clearer for readers. -
The plot labels use
$E[y_t \mid y^{t-1}]$ , while the text says “we plot$E y_t = G \hat x_t$ ”. This could perhaps be written more explicitly as$\mathbb{E}[y_t \mid y^{t-1}] = G \hat x_t$ . -
The plots use embedded titles via
set_title, which may be worth checking against the figure style ruleqe-fig-003.
Would these updates make sense? I’d be happy to put together a PR if they look good to you.
Best,
Longye
Activity
jstac commentedon Jun 14, 2026
Many thanks @longye-tian , great comments.
@HumphreyYang: There are some questions here I'm not sure how to answer. I wasn't involved in building this lecture. Were you?
Otherwise @thomassargent30 might have some thoughts.