A useful analysis is to relate the volatility of a stock's daily percentage change to its expected return. This gives a feel for the risk/return ratio of the investment. This can be performed by mapping the mean of the daily percentage change relative to the standard deviation of the same values.
To demonstrate, the following code will create a scatter plot that relates the risk and return of our sample set of stocks:
In [34]: # generate a scatter of the mean versus std of daily % change plt.scatter(daily_pc.mean(), daily_pc.std()) plt.xlabel('Expected returns') plt.ylabel('Risk') # this adds fancy labels to each dot, with an arrow too for label, x, y in zip(daily_pc.columns, daily_pc.mean(), daily_pc.std()): plt.annotate( label, xy = (x, y), xytext = (30, -30), textcoords = 'offset points', ha = 'right', va = 'bottom', bbox = dict(boxstyle = 'round,pad=0.5', fc = 'yellow', alpha = 0.5), arrowprops = dict(arrowstyle = '->', connectionstyle = 'arc3,rad=0')) # set ranges and scales for good presentation plt.xlim(-0.001, 0.003) plt.ylim(0.005, 0.0275) # set size plt.gcf().set_size_inches(8,8)
The output is seen in the following screenshot:
The results of this immediately jump out from the visualization and may have been more difficult to see by just looking at tables of numbers:
18.225.57.126