Site icon R-bloggers

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.
< section id="motivation" class="level2">

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.

< section id="installation" class="level2">

Installation

You can install the development version from GitHub with:

remotes::install_github("pachadotdev/Kendallknight")
< section id="usage" class="level2">

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"
< section id="details" class="level2">

Details

The package is mostly implemented in C++ using cpp11 to export the functions to R.

< section id="see-more" class="level2">

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.
Exit mobile version