13.08.2022 Views

advanced-algorithmic-trading

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

62

changes as the number of degrees-of-freedom are increased. Notice that the kurtosis becomes

smaller–the tails become less "fat"–representing lesser likelihood of more extreme events:

# student_t_plot.py

import numpy as np

import matplotlib.pyplot as plt

from scipy.stats import t

import seaborn as sns

if __name__ == "__main__":

sns.set_palette("deep", desat=.6)

sns.set_context(rc={"figure.figsize": (8, 4)})

x = np.linspace(-5.0, 5.0, 100)

nus = [1.0, 2.0, 5.0, 50.0]

for nu in nus:

y = t.pdf(x, nu)

ax = plt.plot(x, y, label="$\\nu=%s$" % nu)

plt.xlabel("x")

plt.ylabel("P(x)")

plt.legend(title="Parameters")

plt.show()

Figure 6.2: Different realisations of Student’s t-distribution for various parameters ν.

The degrees of freedom of the Student’s t–how much kurtosis it possesses–is governed by the

ν parameter described above:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!