Figure 11-24. Trace plots for alpha, beta, and sigma based on GDX and GLD data
Figure 11-25 adds all the resulting regression lines to the scatter plot from before. All the
regression lines are pretty close to each other:
In [ 41 ]: plt.figure(figsize=( 8 , 4 ))
plt.scatter(data[‘GDX’], data[‘GLD’], c=mpl_dates, marker=‘o’)
plt.grid(True)
plt.xlabel(‘GDX’)
plt.ylabel(‘GLD’)
for i in range(len(trace)):
plt.plot(data[‘GDX’], trace[‘alpha’][i] + trace[‘beta’][i] * data
[‘GDX’])
plt.colorbar(ticks=mpl.dates.DayLocator(interval= 250 ),
format=mpl.dates.DateFormatter(’%d %b %y’))
Figure 11-25. Scatter plot with “simple” regression lines
The figure reveals a major drawback of the regression approach used: the approach does
not take into account evolutions over time. That is, the most recent data is treated the same
way as the oldest data.
As pointed out at the beginning of this section, the Bayesian approach in finance is