Intro
Intro
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm, pearsonr
np.random.seed(0)
x, y = np.random.normal(0, 1, 1000), 0.5 * np.random.normal(0, 1, 1000) + np.random.norma
corr_coeff, _ = pearsonr(x, y)
plt.scatter(x, y, alpha=0.5)
plt.title(f'Correlation Coefficient: {corr_coeff:.2f}')
plt.xlabel('x')
plt.ylabel('y')
plt.grid(True)
plt.show()
In [ ]:
In [ ]: