implement Pearson's and Spearman's correlation