-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
89 lines (59 loc) · 2.72 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "70%",
echo = FALSE
)
library(ggplot2)
library(qad)
```
# qad <a><img src='man/figures/hex.png' align="right" height="150" /></a>
<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/qad)](https://cran.r-project.org/package=qad)
[![](https://cranlogs.r-pkg.org/badges/qad)](https://cran.r-project.org/package=qad)
<!-- badges: end -->
---
### 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:
- $q(X,Y) = 1$ if and only if $Y$ is a function of $X$ (knowing $X$ means knowing $Y$)
- $q(X,Y) = 0$ if and only if $X$ and $Y$ are independent (no information gain).
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:
```{r, eval = FALSE, echo = TRUE}
install.packages("qad")
```
In order to install the development version of qad from GitHub:
```{r, eval=FALSE, echo = TRUE}
# install devtools package
if (!requireNamespace("devtools", quietly = TRUE)) {
install.packages("devtools")
}
# install package
devtools::install_github("griefl/qad", dependencies = TRUE)
```
### Usage
```{r echo = TRUE}
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)
coef(fit)
#Comparison with correlation
cor(x,y, method = "pearson")
cor(x,y, method = "spearman")
cor(x,y, method = "kendall")
```
### References
- [1] R.R. Junker, F. Griessenberger, W. Trutschnig: Estimating scale-invariant directed dependence of bivariate distributions, *Computational Statistics and Data Analysis*, (2021), 153, 107058, <a href = "https://doi.org/10.1016/j.csda.2020.107058">https://doi.org/10.1016/j.csda.2020.107058</a>
- [2] R.R. Junker, F. Griessenberger, W. Trutschnig: A copula-based measure for quantifying asymmetry in dependence and associations, https://arxiv.org/abs/1902.00203
- [3] W. Trutschnig: On a strong metric on the space of copulas and its induced dependence measure, *Journal of Mathematical Analysis and Applications*, 2011, (384), 690-705. <a href="https://www.sciencedirect.com/science/article/pii/S0022247X11005610">https://doi.org/10.1016/j.jmaa.2011.06.013</a>