-
-
Notifications
You must be signed in to change notification settings - Fork 48
[LakeModel] Simplify computation of the steady state #355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
63d0c92
60e7b02
4de55c7
2473f00
d7d8f3a
9f5259c
cb5d74c
726e17c
6d67088
1cb72ac
c53b86a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
2. provide a method to compute the steady state vector $\bar x$ of employment and unemployment rates using {ref}`a technique <dynamics_workers>` we previously introduced for computing stationary distributions of Markov chains | ||
|
||
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() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest
to
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The former is in principle strictly better: |
||
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 <finite_markov>`. | ||
|
@@ -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]]) | ||
mmcky marked this conversation as resolved.
Show resolved
Hide resolved
|
||
x /= x.sum() | ||
return x | ||
|
||
def simulate_stock_path(self, X0, T): | ||
|
Uh oh!
There was an error while loading. Please reload this page.