SSY Dicretization and the Test Value

How does discretization affect the test value?


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))


D = 2
D = 7
D = 12
D = 17
D = 22
D = 27
D = 32
D = 37
D = 42

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]:
[0.9995589807158951,
 0.9994817896882711,
 0.9994627799752818,
 0.999462607184412,
 0.9994673979921896,
 0.9994581369358213,
 0.9994560716521881,
 0.9994577514068642,
 0.9994468667336092]

In [ ]:


In [ ]: