January 2020
Beginner to intermediate
432 pages
11h 24m
English
Run the following steps to investigate the existence of this first fact by plotting the histogram of returns and a Q-Q plot.
r_range = np.linspace(min(df.log_rtn), max(df.log_rtn), num=1000)mu = df.log_rtn.mean()sigma = df.log_rtn.std()norm_pdf = scs.norm.pdf(r_range, loc=mu, scale=sigma)
fig, ax = plt.subplots(1, 2, figsize=(16, 8))# histogramsns.distplot(df.log_rtn, kde=False, norm_hist=True, ax=ax[0]) ax[0].set_title('Distribution of MSFT returns', fontsize=16) ax[0].plot(r_range, norm_pdf, 'g', lw=2, label=f'N({mu:.2f}, {sigma**2:.4f})')Read now
Unlock full access