GitHub

Original file line numberDiff line numberDiff line change

@@ -511,8 +511,7 @@ def simulate_restricted_var(

511511

"""

512512

Simulate [log consumption growth, log return] from the restricted model.

513513

"""

514-

if seed is not None:

515-

np.random.seed(seed)

514+

rng = np.random.default_rng(seed)

516515
517516

if len(params) != 6 + 2 * n_lags:

518517

raise ValueError("Parameter vector length must be 6 + 2 * n_lags.")

@@ -547,7 +546,7 @@ def simulate_restricted_var(

547546

for lag in range(1, n_lags + 1):

548547

lag_stack.append(y[t - lag, :])

549548

lag_vec = np.concatenate(lag_stack)

550-

shock = np.random.multivariate_normal(np.zeros(2), Σ_v)

549+

shock = rng.multivariate_normal(np.zeros(2), Σ_v)

551550

y[t, :] = np.linalg.solve(A0, A1 @ lag_vec + μ + shock)

552551
553552

return y[burn_in:, :]

Read the original on github.com ↗