In [1]:
import numpy as np
import matplotlib.pyplot as plt
import quantecon as qe
In [2]:
%run src/ssy_discretized_test.py
In [3]:
s = SSY()
In [4]:
def continuous_call(D, num_reps=500):
f = mc_factory(s, K=D, I=D, J=D)
out = np.empty(num_reps)
for i in range(num_reps):
out[i] = f(n=1000, m=1000)
return out.mean()
In [5]:
D1, D2 = 2, 43
rg = range(D1, D2, 5)
In [6]:
lambda_vals = []
for D in rg:
print(f"D = {D}")
lambda_vals.append(continuous_call(D))
In [7]:
fig, ax = plt.subplots()
ax.plot(rg, lambda_vals, label="With discretization")
ax.plot(rg, 0.999482 * np.ones(len(rg)), 'k--', label="Without discretization")
ax.set_xlabel("level of discretization $D$", fontsize=12)
ax.set_ylabel("$\Lambda$")
ax.set_ylim((0.99925, 0.99985))
ax.legend(loc="upper right")
plt.savefig("ssy_test_val_vs_discretization.pdf")
plt.show()
In [8]:
lambda_vals
Out[8]:
In [ ]:
In [ ]: