In [1]:
# == Basic import == #
# plot within the notebook
%matplotlib inline
# No annoying warnings
import warnings
warnings.filterwarnings('ignore')
In [32]:
import numpy as np
In [ ]:
x = np.random.rand(200)
y = np.random.rand(200)
In [34]:
import matplotlib.pyplot as mpl
mpl.plot(x,y, ls="None",marker="s",ms=15, mfc="None")
Out[34]:
In [36]:
z = x*3 + np.random.normal(0,scale=0.3,size=200)
In [37]:
mpl.plot(x,z, ls="None",marker="s",ms=15, mfc="None")
Out[37]:
And measure the Pearson Correlation coefficient
In [38]:
from scipy import stats
First value rho, second p-value (see future lesson)
In [39]:
stats.pearsonr(x,y)
Out[39]:
In [40]:
stats.pearsonr(x,z)
Out[40]:
In [ ]: