def computeSlope(y): """compute slope of y best fit line to y under a linear regression""" x = np.arange(len(y)) y -= np.mean(y) slope, _, _, _, _ = stats.linregress(x, y) return slope