GitHub

Original file line numberDiff line numberDiff line change

@@ -642,7 +642,7 @@ mystnb:

642642

caption: Standard vs robust consumption paths

643643

name: fig-std-vs-robust-paths

644644

---

645-

np.random.seed(0)

645+

rng = np.random.default_rng(0)

646646

T_sim = 100

647647
648648

def simulate_ar1(φ, ν, shocks, mu0=0.0):

@@ -652,7 +652,7 @@ def simulate_ar1(φ, ν, shocks, mu0=0.0):

652652

path[t] = φ * path[t-1] + ν * ε

653653

return path

654654
655-

shock_path = np.random.randn(T_sim - 1)

655+

shock_path = rng.standard_normal(T_sim - 1)

656656

mu0_init = 10.0

657657

mu_std_path = simulate_ar1(φ_std, ν_std, shock_path, mu0=mu0_init)

658658

mu_rob_path = simulate_ar1(φ_rob, ν_rob, shock_path, mu0=mu0_init)

Read the original on github.com ↗