# wdm: Weighted Dependence Measures In wdm: Weighted Dependence Measures

 wdm R Documentation

## Weighted Dependence Measures

### Description

Computes a (possibly weighted) dependence measure between `x` and `y` if these are vectors. If `x` and `y` are matrices then the measure between the columns of `x` and the columns of `y` are computed.

### Usage

```wdm(x, y = NULL, method = "pearson", weights = NULL, remove_missing = TRUE)
```

### Arguments

 `x` a numeric vector, matrix or data frame. `y` `NULL` (default) or a vector, matrix or data frame with compatible dimensions to x. The default is equivalent to 'y = x“ (but more efficient). `method` the dependence measure; see Details for possible values. `weights` an optional vector of weights for the observations. `remove_missing` if `TRUE`, all (pairswise) incomplete observations are removed; if `FALSE`, the function throws an error if there are incomplete observations.

### Details

Available methods:

• `"pearson"`: Pearson correlation

• `"spearman"`: Spearman's ρ

• `"kendall"`: Kendall's τ

• `"blomqvist"`: Blomqvist's β

• `"hoeffding"`: Hoeffding's D Partial matching of method names is enabled.

Spearman's ρ and Kendall's τ are corrected for ties if there are any.

### Examples

```##  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
wdm(x, y, method = "kendall", weights = w)  # weighted

##  dependence in a matrix
x <- matrix(rnorm(100 * 3), 100, 3)
wdm(x, method = "spearman")               # unweighted
wdm(x, method = "spearman", weights = w)  # weighted

##  dependence between columns of two matrices
y <- matrix(rnorm(100 * 2), 100, 2)
wdm(x, y, method = "hoeffding")               # unweighted
wdm(x, y, method = "hoeffding", weights = w)  # weighted

```

wdm documentation built on March 18, 2022, 5:24 p.m.