8
$\begingroup$

I am using R for data analysis. R provides a corr function for calculating the correlation. This function provides three different approaches/algorithms to estimating the corr which are Pearson, Spearman and Kendall. When should I use each of each of these methods? What factors determine which method should be used?

$\endgroup$

migrated from datascience.stackexchange.com Jun 26 '14 at 22:30

This question came from our site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field.

  • $\begingroup$ Although this is in the context of R, the question is indeed about the difference between three statistical measures. I'd say migrate too. $\endgroup$ – Sean Owen Jun 26 '14 at 22:30
  • 1
    $\begingroup$ This question has already been asked at stats.stackexchange.com/questions/45897/… (but has not yet gotten any answers). Our site has extensive material on correlation, especially comparing Pearson and Spearman coefficients: see the search results at stats.stackexchange.com/…. $\endgroup$ – whuber Jun 26 '14 at 22:35
10
$\begingroup$

Pearson's product-moment coefficient (pearson parameter) measures linear correlation between variables. Therefore it is appropriate when your suspected correlation is linear, which can be visually inspected with a plot.

Kendall Tau coefficient (kendall paramter) and Spearman's correlation coefficient (spearman parameter) are measures rank correlations. So the correlation between the two variables does not need to be linear. spearman method is basically the pearson method, but applied on the ranks of the values (the rank of a value is given by it's position after sorting the values). kendal method is build basically as a statistic in a form of a ration between the additional number of ordered pairs and the total number of pairs. For kendal method, because it is build as a statistic, one can build also use it in the framework of hypothesis testing, with all the benefits (it is called tau test).

All these methods are instruments used to infer something about the dependencies between random variables. See more on Wikipedia dedicated page dedicated to Correlation and Dependence

$\endgroup$
  • $\begingroup$ Isn't it also true that Spearman and Pearson should also be identical for linear relationships so if in doubt you can use Spearman and be confident that you won't get thrown off if the correlation happens to be non-linear? $\endgroup$ – cwharland May 14 '14 at 17:48
  • 1
    $\begingroup$ To be honest, I do not know if they are equals in linear relationship. It's sure that pearson on ranks is spearman. However, during transformation to ranks some things happens: pearson becomes more robust to outliers, the covariance is irremediably altered, pearson incorporates possibly non-independent noise (perhaps generated by confounders). In general I use pearson for linear-based inference, spearman to check if there is something else other than linearity, plus for ordinals (which makes sense only for spearman). $\endgroup$ – rapaio May 14 '14 at 18:37
  • $\begingroup$ @cwharland In fact they tend not to be equal for linear relationships. In correlated bivariate normal samples (which has the linear relationship you suggest) the Spearman correlation is typically (both on average and in terms of the median of its distribution) closer to 0 than the Pearson. Both are biased, but the Pearson is less so. $\endgroup$ – Glen_b Jul 1 '14 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.