Skip to content
Weighted Dependence Measures
R C++
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R fix typos and formatting issues in man pages (#5) Nov 3, 2018
docs update docs Apr 11, 2019
inst @ 6df8f6f use linear formula for pearson cor Feb 7, 2019
man fix typos and formatting issues in man pages (#5) Nov 3, 2018
revdep use revdep Jun 12, 2018
src don't strip debug symbols Apr 11, 2019
tests
.Rbuildignore use revdep Jun 12, 2018
.gitignore use revdep Jun 12, 2018
.gitmodules use public link for submodule May 22, 2018
.travis.yml don't strip debug symbols Apr 11, 2019
DESCRIPTION update docs Apr 11, 2019
LICENSE prepare release May 28, 2018
LICENSE.md cleanup May 17, 2018
NAMESPACE add interface for independence test May 22, 2018
NEWS.md don't strip debug symbols Apr 11, 2019
README.Rmd first release on CRAN (#4) May 30, 2018
README.md
appveyor.yml make continuous integration work (#3) May 22, 2018
codecov.yml add coverage report May 22, 2018
cran-comments.md update docs Apr 11, 2019
wdm.Rproj update Apr 19, 2018

README.md

wdm

Travis build status AppVeyor build status Coverage status CRAN status

R interface to the wdm C++ library, which provides efficient implementations of weighted dependence measures and related independence tests:

  • Pearsons's rho
  • Spearmans's rho
  • Kendall's tau
  • Blomqvist's beta
  • Hoeffding's D

All measures are computed in O(n log n) time, where n is the number of observations.

For a detailed description of the functionality, see the API documentation.

Installation

  • the stable release from CRAN:
install.packages("wdm")
  • the development version from GitHub with:
# install.packages("devtools")
install_submodule_git <- function(x, ...) {
  install_dir <- tempfile()
  system(paste("git clone --recursive", shQuote(x), shQuote(install_dir)))
  devtools::install(install_dir, ...)
}
install_submodule_git("https://github.com/tnagler/wdm-r")

Cloning

This repo contains wdm as a submodule. For a full clone use

git clone --recurse-submodules <repo-address>

Examples

library(wdm)
Dependence between two vectors
x <- rnorm(100)
y <- rpois(100, 1)  # all but Hoeffding's D can handle ties
w <- runif(100)
wdm(x, y, method = "kendall")               # unweighted
#> [1] -0.002378163
wdm(x, y, method = "kendall", weights = w)  # weighted
#> [1] 0.08897884
Dependence in a matrix
x <- matrix(rnorm(100 * 3), 100, 3)
wdm(x, method = "spearman")               # unweighted
#>            [,1]        [,2]        [,3]
#> [1,]  1.0000000 -0.23383138 -0.05200120
#> [2,] -0.2338314  1.00000000 -0.03560756
#> [3,] -0.0520012 -0.03560756  1.00000000
wdm(x, method = "spearman", weights = w)  # weighted
#>            [,1]        [,2]        [,3]
#> [1,]  1.0000000 -0.13603502 -0.12951931
#> [2,] -0.1360350  1.00000000 -0.07473239
#> [3,] -0.1295193 -0.07473239  1.00000000
Independence test
x <- rnorm(100)
y <- rpois(100, 1)  # all but Hoeffding's D can handle ties
w <- runif(100)
indep_test(x, y, method = "kendall")               # unweighted
#>      estimate  statistic   p_value n_eff  method alternative
#> 1 -0.05555546 -0.6291182 0.5292717   100 kendall   two-sided
indep_test(x, y, method = "kendall", weights = w)  # weighted
#>      estimate  statistic   p_value   n_eff  method alternative
#> 1 -0.09298105 -0.9139628 0.3607364 75.5839 kendall   two-sided
You can’t perform that action at this time.