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.

28

P (θ|α, β) = θ α−1 (1 − θ) β−1 /B(α, β) (3.10)

Where the term in the denominator, B(α, β) is present to act as a normalising constant so

that the area under the PDF actually sums to 1.

I’ve plotted a few separate realisations of the beta distribution for various parameters α and

β in Figure 3.1.

Figure 3.1: Different realisations of the beta distribution for various parameters α and β.

To plot the image yourself, you will need to install seaborn:

pip install seaborn

The Python code to produce the plot is given below:

# beta_plot.py

import numpy as np

from scipy.stats import beta

import matplotlib.pyplot as plt

import seaborn as sns

if __name__ == "__main__":

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

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

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

Saved successfully!

Ooh no, something went wrong!