Calculating correlation coefficient