r_num = np.add.reduce(xm * ym)
r_den = np.sqrt(ss(xm) * ss(ym))
r = r_num / r_den
r = max(min(r, 1.0), -1.0)
df = n - 2
if abs(r) == 1.0:
    prob = 0.0
else:
    t_squared = r * r * (df / ((1.0 - r) * (1.0 + r)))
prob = betai(0.5 * df, 0.5, df / (df + t_squared))
return r, prob
How to get the numerical fitting results when plotting a regression in seaborn?