Calculating the Pearson's coefficient of correlation