Skip to content

Commit 39336cf

Browse files
committed
add seed to code
1 parent 54e660c commit 39336cf

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

lectures/gorman_heterogeneous_households.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,8 @@ Using the `LQ` class, we solve the LQ problem and simulate paths for the full st
12541254
Finally, we call `compute_household_paths` to get household allocations and limited-markets portfolios along the simulated path
12551255
12561256
```{code-cell} ipython3
1257-
def solve_model(info, tech, pref, U_b_list, U_d_list, γ_1, Λ, z0, ts_length=2000):
1257+
def solve_model(info, tech, pref, U_b_list, U_d_list, γ_1, Λ,
1258+
z0, ts_length=2000, seed=1):
12581259
"""
12591260
Solve the representative-agent DLE problem and compute household paths.
12601261
"""
@@ -1269,7 +1270,8 @@ def solve_model(info, tech, pref, U_b_list, U_d_list, γ_1, Λ, z0, ts_length=20
12691270
# Solve LQ problem and simulate paths
12701271
lq = LQ(econ.Q, econ.R, econ.A, econ.B,
12711272
econ.C, N=econ.W, beta=econ.beta)
1272-
x_path, _, _ = lq.compute_sequence(x0_full, ts_length=ts_length)
1273+
x_path, _, _ = lq.compute_sequence(x0_full,
1274+
ts_length=ts_length, random_state=seed)
12731275
12741276
paths = compute_household_paths(
12751277
econ=econ,
@@ -1372,7 +1374,8 @@ ts_length = 2_000
13721374
# Solve LQ problem and simulate paths
13731375
lq = LQ(econ.Q, econ.R, econ.A, econ.B,
13741376
econ.C, N=econ.W, beta=econ.beta)
1375-
x_path, _, _ = lq.compute_sequence(x0, ts_length=ts_length)
1377+
x_path, _, _ = lq.compute_sequence(x0,
1378+
ts_length=ts_length, random_state=1)
13761379
13771380
paths = compute_household_paths(
13781381
econ=econ,
@@ -1395,7 +1398,7 @@ mystnb:
13951398
name: fig-gorman-consumption
13961399
---
13971400
T_plot = 250
1398-
t0 = 200
1401+
t0 = 200
13991402
14001403
fig, ax = plt.subplots()
14011404
ax.plot(paths["c"][0, t0:t0+T_plot], lw=2, label="aggregate")

0 commit comments

Comments
 (0)