Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjam03/eb817a36bc16184f45405892dff7bd78 to your computer and use it in GitHub Desktop.
Save mjam03/eb817a36bc16184f45405892dff7bd78 to your computer and use it in GitHub Desktop.
fat_tails_and_their_impact_on_option_prices1
# define normal pdf
def norm_pdf(x, sigma=1):
return (1 / np.sqrt(2*np.pi)) * (1 / sigma) * np.exp(-0.5 * (x/sigma)**2)
# define x's we want to compute pdf for
xs = np.linspace(-4, 4, 8*200 + 1)
# define epsilsons
eps = [0, 0.1, 0.2, 0.5]
# create pdfs
perturbs = []
for e in eps[::-1]:
p = [0.5 * (norm_pdf(x, 1 + e) + norm_pdf(x, 1 - e)) for x in xs]
perturbs.append([xs, p])
# plot
fig, ax = plt.subplots(figsize=(25,10))
for dist, e in zip(perturbs, eps[::-1]):
ax.plot(dist[0], dist[1], label="e = {}".format(e))
ax.set_title("PDFs when averaging normal distributions", fontsize=24)
ax.set_xlabel("x", fontsize=20)
ax.set_ylabel("Density", fontsize=20)
ax.legend(fontsize=14);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment