Spearman correlation with PerformanceAnalytics chart.correlation: how to avoid "cannot compute exact p-values with ties"?

530 Views Asked by At

I'm very new to R (and in general to anything to do with coding) so bear with me please...

I'm running a Spearman rank correlation on a data matrix and have the following code in Rstudio:

Experts <- read.table(file="full_vs_experts.txt", header=TRUE, row.names=1)
head(Experts, n=16)
res <- cor(Experts, method="spearman")
round(res, 2)
library("Hmisc")
res2 <- rcorr((as.matrix(Experts)), type = c("spearman"))
res2
library("PerformanceAnalytics")
chart.Correlation(Experts, histogram=TRUE, pch=19, method="spearman", exact=FALSE)

So this gives me the chart, as I asked for, but also gives me the warning message:

In cor.test.default(as.numeric(x), as.numeric(y), method = method) :
  Cannot compute exact p-value with ties

I've already added the exact=FALSE argument, which is all I seem to find on forums to get rid of this warning, but this doesn't work. It doesn't even seem to recognize the exact=FALSE argument at all I believe? Does anyone know another way to get rid of this warning?

1

There are 1 best solutions below

0
anphan0828 On

Have you tried adding exact=False in 2 previous correlation calculations as well?

res <- cor(Experts, method="spearman",exact=FALSE)
res2 <- rcorr((as.matrix(Experts)), type = c("spearman"),exact=FALSE)