GitHub

@@ -606,8 +606,8 @@ def simulate_samuelson(

606606607607

# Generate shocks if stochastic

608608

if σ > 0:

609-

np.random.seed(seed)

610-

ϵ = np.random.normal(0, 1, n)

609+

rng = np.random.default_rng(seed)

610+

ϵ = rng.normal(0, 1, n)

611611612612

# Simulate forward

613613

for t in range(2, n):

@@ -1190,7 +1190,8 @@ C[1] = σ # Shock variance

1190119011911191

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

119211921193-

x, y = sam_t.simulate(ts_length=n)

1193+

rng = np.random.default_rng()

1194+

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

1194119511951196

fig, axes = plt.subplots(3, 1, sharex=True, figsize=(12, 8))

11961197

titles = ["Output ($Y_t$)", "Consumption ($C_t$)", "Investment ($I_t$)"]

@@ -1303,8 +1304,8 @@ class SamuelsonLSS(LinearStateSpace):

13031304

except ValueError:

13041305

print("Stationary distribution does not exist")

130513061306-

np.random.seed(seed)

1307-

x, y = self.simulate(ts_length)

1307+

rng = np.random.default_rng(seed)

1308+

x, y = self.simulate(ts_length, random_state=rng)

1308130913091310

fig, axes = plt.subplots(3, 1, sharex=True, figsize=(12, 8))

13101311

titles = ["Output ($Y_t$)",

Read the original on github.com ↗