Introduction
Statistics¶
We are going to explore a few things in terms of statistics for this lesson, and specifically work a bit with bollinger bands as an example of using some statistics. First, the code below just creates data but can be ignored. It will be a random stock price that we can think about analyzing.
In [1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
np.random.seed(1)
base = np.array([100] * 200)
random_error = np.random.normal(0, .01, 200) * 100
random_error = np.cumsum(random_error)
trend = np.array([0] * 60+[-.5]*20+[.5]*20+[0]*60+[-.5]*20+[.5]*20)
trend = np.cumsum(trend)
df = pd.Series(base + random_error+trend)
plt.plot(df)
plt.show()