qad

CRAN status


Summary

The R-package qad (short for quantification of asymmetric dependence) allows to estimate the (directed) dependence of two random variables X and Y. The estimated population value q(X,Y) introduced in [1,3] fulfills the following properties:

While the Pearson correlation coefficient assesses only linear and Spearman rank correlation only monotonic relationships, qad is able to detect any kind of association. For further information we refer to the vignette or the related publications [1,2,3].

Installation

The easiest way to get the package qad is:

install.packages("qad")

In order to install the development version of qad from GitHub:

# install devtools package
if (!requireNamespace("devtools", quietly = TRUE)) {
  install.packages("devtools")
}
# install package
devtools::install_github("griefl/qad", dependencies = TRUE)

Usage

library(qad)

set.seed(314)
n <- 100
x <- rnorm(n)
y <- x^2 + rnorm(n, 0, 1)
plot(x,y, pch = 16)

fit <- qad(x,y)
#> 
#> quantification of asymmetric dependence: 
#> 
#> Data: x1 := x
#>       x2 := y
#> 
#> Sample Size: 100
#> Number of unique ranks: x1: 100
#>                         x2: 100
#>                    (x1,x2): 100
#> Resolution: 10 x 10
#> 
#> Dependence measures:
#>                     q p.values
#>  q(x1,x2)       0.610    0.000
#>  q(x2,x1)       0.393    0.002
#>  max.dependence 0.610    0.000
#> 
#>                      a p.values
#>  asymmetry       0.217       NA
coef(fit)
#>         q(x1,x2)         q(x2,x1)   max.dependence        asymmetry 
#>            0.610            0.393            0.610            0.217 
#>       p.q(x1,x2)       p.q(x2,x1) p.max.dependence      p.asymmetry 
#>            0.000            0.002            0.000               NA

#Comparison with correlation
cor(x,y, method = "pearson")
#> [1] -0.04404337
cor(x,y, method = "spearman")
#> [1] 0.06546655
cor(x,y, method = "kendall")
#> [1] 0.05090909

References