Open
Description
Hi,
I have noticed that I get discrepancies in correlation coefficients if the compare the output from the partial correlation in cor_test to the output from pcor.test in ppcor. This happens for Spearman's and Kendall's , but not for Pearson's. Is this correct?
Example:
a <- c(1, 1, 1, 2, 2, 2, 3, 4, 5, 5)
b <- c(1, 1, 2, 2, 1, 2, 2, 2, 2, 2)
c <- c(3, 2, 3, 3, 1, 4, 4, 6, 4, 1)
data <- data.frame(a, b, c)
pearson_pcor <- ppcor::pcor.test(data$a, data$b, data$c, "pearson")
pearson_cor <- correlation::cor_test(data = data, "a", "b", partial = TRUE, "pearson")
print(pearson_cor)
print(pearson_pcor)
spearman_pcor <- ppcor::pcor.test(data$a, data$b, data$c, "spearman")
spearman_cor <- correlation::cor_test(data = data, "a", "b", partial = TRUE, "spearman")
print(spearman_cor)
print(spearman_pcor)
kendall_pcor <- ppcor::pcor.test(data$a, data$b, data$c, "kendall")
kendall_cor <- correlation::cor_test(data = data, "a", "b", partial = TRUE, "kendall")
print(kendall_cor)
print(kendall_pcor)