From 84e7dfc9e5be80b0f6dd0a340888a0f017200972 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 19 Dec 2023 16:01:37 +1100 Subject: [PATCH] REPLICA: PR #355 --- lectures/lake_model.md | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/lectures/lake_model.md b/lectures/lake_model.md index 280fc978c..045e62114 100644 --- a/lectures/lake_model.md +++ b/lectures/lake_model.md @@ -218,7 +218,7 @@ This class will 1. store the primitives $\alpha, \lambda, b, d$ 1. compute and store the implied objects $g, A, \hat A$ 1. provide methods to simulate dynamics of the stocks and rates -1. provide a method to compute the steady state of the rate +1. provide a method to compute the steady state of the rate (We will discuss it in section {ref}`dynamics_workers`) Please be careful because the implied objects $g, A, \hat A$ will not change if you only change the primitives. @@ -265,12 +265,8 @@ class LakeModel: -------- xbar : steady state vector of employment and unemployment rates """ - x = np.full(2, 0.5) - error = tol + 1 - while error > tol: - new_x = self.A_hat @ x - error = np.max(np.abs(new_x - x)) - x = new_x + x = np.array([self.A_hat[0, 1], self.A_hat[1, 0]]) + x /= x.sum() return x def simulate_stock_path(self, X0, T): @@ -415,6 +411,7 @@ plt.tight_layout() plt.show() ``` +(dynamics_workers)= ## Dynamics of an Individual Worker An individual worker's employment dynamics are governed by a {doc}`finite state Markov process `. @@ -1016,12 +1013,8 @@ class LakeModelModified: -------- xbar : steady state vector of employment and unemployment rates """ - x = np.full(2, 0.5) - error = tol + 1 - while error > tol: - new_x = self.A_hat @ x - error = np.max(np.abs(new_x - x)) - x = new_x + x = np.array([self.A_hat[0, 1], self.A_hat[1, 0]]) + x /= x.sum() return x def simulate_stock_path(self, X0, T):