MyNixOS website logo
Description

Weighted Dependence Measures.

Provides efficient implementations of weighted dependence measures and related asymptotic tests for independence. Implemented measures are the Pearson correlation, Spearman's rho, Kendall's tau, Blomqvist's beta, and Hoeffding's D; see, e.g., Nelsen (2006) <doi:10.1007/0-387-28678-0> and Hollander et al. (2015, ISBN:9780470387375).

wdm

R-CMD-check CRANstatus CRAN downloads

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.03093257
wdm(x, y, method = "kendall", weights = w)  # weighted
#> [1] 0.04835766
Dependence in a matrix
x <- matrix(rnorm(100 * 3), 100, 3)
wdm(x, method = "spearman")               # unweighted
#>             [,1]      [,2]        [,3]
#> [1,]  1.00000000 0.2194659 -0.05435344
#> [2,]  0.21946595 1.0000000  0.11401140
#> [3,] -0.05435344 0.1140114  1.00000000
wdm(x, method = "spearman", weights = w)  # weighted
#>            [,1]      [,2]       [,3]
#> [1,]  1.0000000 0.2575236 -0.1689466
#> [2,]  0.2575236 1.0000000  0.1197442
#> [3,] -0.1689466 0.1197442  1.0000000
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.1278922  1.532215 0.1254693   100 kendall   two-sided
indep_test(x, y, method = "kendall", weights = w)  # weighted
#>    estimate statistic    p_value   n_eff  method alternative
#> 1 0.1704296  1.779486 0.07516007 79.6939 kendall   two-sided
Metadata

Version

0.2.4

License

Unknown

Platforms (75)

    Darwin
    FreeBSD 13
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd13
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd13
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows