A Test of the Impact of Truncation on Stability


In [1]:
import matplotlib.pyplot as plt

In [2]:
%run src/ssy_mc_truncation_test.py

In [3]:
ssy = SSY()

In [4]:
f = ssy_function_factory(ssy)

In [5]:
seed = 12345
f(seed=seed)


Out[5]:
0.9994263032654819

In [6]:
G = 20
trunc_vals = np.linspace(0.5, 5.0, G)

In [7]:
out = []
for t in trunc_vals:
    out.append(f(trunc_val=t, seed=seed))

In [8]:
out


Out[8]:
[0.9997347219350236,
 0.9997018845618485,
 0.9996578142957393,
 0.9996080264158458,
 0.9995576461928415,
 0.9995113199528328,
 0.9994778562352965,
 0.9994538186977308,
 0.9994378984947216,
 0.9994273473187253,
 0.9994229849313937,
 0.9994242278273044,
 0.9994255798660963,
 0.9994262846959924,
 0.9994262912676423,
 0.999426311811583,
 0.9994263137000875,
 0.9994263108588153,
 0.9994263079905,
 0.9994263050511673]

In [9]:
fig, ax = plt.subplots()
ax.plot(trunc_vals, out, label="$\Lambda$ with truncation")
ax.plot(trunc_vals, np.ones(G) * f(seed=seed), "k--",  label="$\Lambda$ without explicit truncation")
ax.set_ylim((0.99925, 0.99985))
ax.set_ylabel("$\Lambda$")
ax.set_xlabel("Truncation value")
ax.legend()
plt.tight_layout()
plt.savefig("temp.pdf")