@@ -58,7 +58,7 @@ To conduct simulations, we bring in these imports, as in {doc}`kalman`.
5858import matplotlib.pyplot as plt
5959import numpy as np
6060from quantecon import Kalman, LinearStateSpace
61-from collections import namedtuple
61+from typing import NamedTuple
6262from scipy.stats import multivariate_normal
6363import matplotlib as mpl
6464mpl.rcParams['text.usetex'] = True
@@ -161,11 +161,17 @@ x_t = \begin{bmatrix} h_{t} \cr u_{t} \end{bmatrix} , \quad
161161 0 & \sigma_{u,0}^2 \end{bmatrix}
162162```
163163164-To compute the firm's wage setting policy, we first create a `namedtuple` to store the parameters of the model
164+To compute the firm's wage setting policy, we first create a `NamedTuple` to store the parameters of the model
165165166166```{code-cell} ipython3
167-WorkerModel = namedtuple("WorkerModel",
168- ('A', 'C', 'G', 'R', 'xhat_0', 'Σ_0'))
167+class WorkerModel(NamedTuple):
168+ A: np.ndarray
169+ C: np.ndarray
170+ G: np.ndarray
171+ R: float
172+ xhat_0: np.ndarray
173+ Σ_0: np.ndarray
174+169175170176def create_worker(α=.8, β=.2, c=.2,
171177 R=.5, g=1.0, hhat_0=4, uhat_0=4,
@@ -188,7 +194,7 @@ def create_worker(α=.8, β=.2, c=.2,
188194 return WorkerModel(A=A, C=C, G=G, R=R, xhat_0=xhat_0, Σ_0=Σ_0)
189195```
190196191-Please note how the `WorkerModel` namedtuple creates all of the objects required to compute an associated
197+Please note how the `WorkerModel` NamedTuple creates all of the objects required to compute an associated
192198state-space representation {eq}`ssrepresent`.
193199194200This is handy, because in order to simulate a history $\{y_t, h_t\}$ for a worker, we'll want to form
@@ -466,7 +472,7 @@ plt.show()
466472```
467473468474More generally, we can change some or all of the parameters defining a worker in our `create_worker`
469-namedtuple.
475+factory function.
470476471477Here is an example.
472478