Long-Tailed Distributions¶
InĀ [1]:
Copied!
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import probplot
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import probplot
InĀ [2]:
Copied!
nflx = pd.read_csv("../data/sp500_data.csv").NFLX
nflx = np.diff(np.log(nflx[nflx>0]))
fig, ax = plt.subplots(figsize=(4,4))
probplot(nflx, plot=ax)
nflx = pd.read_csv("../data/sp500_data.csv").NFLX
nflx = np.diff(np.log(nflx[nflx>0]))
fig, ax = plt.subplots(figsize=(4,4))
probplot(nflx, plot=ax)
Out[2]:
((array([-3.33278964, -3.07756454, -2.93575124, ..., 2.93575124,
3.07756454, 3.33278964], shape=(1612,)),
array([-6.60529819, -6.09667121, -5.40220961, ..., 5.12547859,
5.87072271, 6.03787 ], shape=(1612,))),
(np.float64(1.4823778663727092),
np.float64(0.0015561067366313861),
np.float64(0.9941828221936319)))
InĀ [3]:
Copied!
import seaborn as sns
plt.hist(nflx, density=True, bins=30, alpha=0.5, edgecolor='black')
sns.kdeplot(nflx, color='orange', linewidth=2)
import seaborn as sns
plt.hist(nflx, density=True, bins=30, alpha=0.5, edgecolor='black')
sns.kdeplot(nflx, color='orange', linewidth=2)
Out[3]:
<Axes: ylabel='Density'>