Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lectures/samuelson.md
Original file line number Diff line number Diff line change
Expand Up @@ -606,8 +606,8 @@ def simulate_samuelson(

# Generate shocks if stochastic
if σ > 0:
np.random.seed(seed)
ϵ = np.random.normal(0, 1, n)
rng = np.random.default_rng(seed)
ϵ = rng.normal(0, 1, n)

# Simulate forward
for t in range(2, n):
Expand Down Expand Up @@ -1190,7 +1190,8 @@ C[1] = σ # Shock variance

sam_t = LinearStateSpace(A, C, G, mu_0=μ_0)

x, y = sam_t.simulate(ts_length=n)
rng = np.random.default_rng()
x, y = sam_t.simulate(ts_length=n, random_state=rng)

fig, axes = plt.subplots(3, 1, sharex=True, figsize=(12, 8))
titles = ["Output ($Y_t$)", "Consumption ($C_t$)", "Investment ($I_t$)"]
Expand Down Expand Up @@ -1303,8 +1304,8 @@ class SamuelsonLSS(LinearStateSpace):
except ValueError:
print("Stationary distribution does not exist")

np.random.seed(seed)
x, y = self.simulate(ts_length)
rng = np.random.default_rng(seed)
x, y = self.simulate(ts_length, random_state=rng)

fig, axes = plt.subplots(3, 1, sharex=True, figsize=(12, 8))
titles = ["Output ($Y_t$)",
Expand Down
Loading