Computing Pearson and Spearman correlations