Kendallknight: an R package for Kendall’s correlation coefficient
[This article was first published on pacha.dev/blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Motivation
Existing R packages, such as pcaPP, provide efficient implementations of the Kendall correlation coefficient. However, I wanted to create my own package exclusively for this purpose, without additional functions, and that it also allows to test hypothesis about the correlation coefficient.
Installation
You can install the development version from GitHub with:
remotes::install_github("pachadotdev/Kendallknight")
Usage
library(kendallknight) x <- c(1, 2, 3, 4, 5) y <- c(5, 4, 3, 2, 1) kendall_cor(x, y) kendall_cor_test(x, y, "two.sided") > kendall_cor(x, y) [1] -1 > kendall_cor_test(x, y, "two.sided") $statistic [1] -1 $p_value [1] 0.01666667 $alternative [1] "alternative hypothesis: true tau is not equal to 0"
Details
The package is mostly implemented in C++ using cpp11 to export the functions to R.
See more
To leave a comment for the author, please follow the link and comment on their blog: pacha.dev/blog.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.