Running cor() and cor.test() gives me the same p-value in R but cor.test() also throws a warning:

> cor(diamonds$price, diamonds$carat, method = 'spearman')
[1] 0.9628828
> cor.test(diamonds$price, diamonds$carat, method = 'spearman')

    Spearman's rank correlation rho

data:  diamonds$price and diamonds$carat
S = 9.7086e+11, p-value < 2.2e-16
alternative hypothesis: true rho is not equal to 0
sample estimates:

Warning message:
In cor.test.default(diamonds$price, diamonds$carat, method = "spearman") :
  Cannot compute exact p-value with ties

Does this warning effect the p-value and should I not use this test?

  • 1
    $\begingroup$ I would say this is not a problem. However, you can find more detailed information regarding this function and its handling of ties in the documentation. $\endgroup$ Commented May 18, 2020 at 14:30


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.