I would like to perform a robust correlation on a small sample (n<30). What is the best estimation method to use?

I tried to get an overview over the plenty methods for robust statistics provided in R - I would be happy if anyone could give me some recommendations

  • 5
    $\begingroup$ "Best" for what purpose? How do you intend to use the correlation estimate once you have it? What are the potential consequences of making an estimation error due to the influence of a few outlying data? Are you trying to estimate Pearson correlation or do you just want a quantitative assessment of a strength of (linear?) relationship between two variables? $\endgroup$
    – whuber
    Sep 5, 2012 at 18:19
  • 2
    $\begingroup$ Robust to violations of which assumptions? Do you believe your data are non-normally distributed, have restricted range, are rank data? The best method will depend on the process which generated the data - often a simple rank order correlation is a good option in these cases. $\endgroup$
    – analystic
    Sep 23, 2012 at 4:42

2 Answers 2


MASS::cov.rob (link to man page) has two methods for robust covariances, which you can standardize to correlations with cov2cor. @whuber is right that the "best" method will depend on what you want to do with it, though..

  • $\begingroup$ @whuber and david, thank you for your help. I would like to receive an assessment of strength of a (yes, potentially linear) relationship. 'best' in terms of dealing with a small sample, non-normal distribution, and few extremes (or outliers), what is not achieved with Pearson or Spearman. so I found something about winsorizing...but am not sure whether this is the correct path to go? $\endgroup$
    – kirstin
    Sep 5, 2012 at 20:24

I implemented these correlation measures in R, it is super easy using robustbase package:


The assessment of performance for contaminated sample case is provided in the end of the article (for n=20 and n=1000). You may concentrate on $Q_n$ correlation, it works the best according to the assessment.

UPD: I recently found myself googling for a robust correlation code in R and found out this thread again. Here is the code: robust_correlation <- function(robust_std, estimation_of_center_x, estimation_of_center_y, x, y) { square_root_of_two <- sqrt(2) std_of_x <- robust_std(x) std_of_y <- robust_std(y) first_component = (x - estimation_of_center_x) / (square_root_of_two * std_of_x) second_component = (y - estimation_of_center_y) / (square_root_of_two * std_of_y) u = first_component + second_component v = first_component - second_component var_of_u = robust_std(u) ** 2 var_of_v = robust_std(v) ** 2 r = (var_of_u - var_of_v) / (var_of_u + var_of_v + 10**-10) return® }


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