The R-Package RDM (rearranged dependence measures) computes the directed
dependence between random variables
The rearranged dependence measure
-
$R_\mu(X, Y) \in [0, 1]$ , -
$R_\mu(X, Y) = 0$ if and only if$X$ and$Y$ are independent, -
$R_\mu(X, Y) = 1$ if and only if$Y = f(X)$ for some (not necessarily affine or monotone) function$f$ .
Crucially, while underlying measures such as
For more information on the theoretical properties of
You can install the development version of RDM via:
# install devtools package
if (!requireNamespace("devtools", quietly = TRUE)) {
install.packages("devtools")
}
# install package
devtools::install_github("https://github.com/ChristopherStrothmann/RDM", dependencies = TRUE)Let us first illustrate the basic usage of the RDM-Package
library(RDM)
n <- 500
x1 <- runif(n)
X <- cbind(x1, 0.5*sin(4*pi*x1)+0.5)
plot(X, xlab="X", ylab="f(X)")#Computes R_mu(X, Y) using Spearman's rho as the underlying measure
#and a fixed bandwidth 500^(0.5) of the underlying copula estimator
rdm(X, method="spearman", bandwidth_method="fixed", bandwidth_parameter = 0.5)
#> [1] 0.9811719
#Comparison to the Spearman's rho
cor(X[, 1], X[, 2], method="spearman")
#> [1] -0.3248678
#Computes R_mu(X, Y) using all implemented underlying measures
results <- rdm(X, method="all", bandwidth_method="fixed", bandwidth_parameter = 0.5)
#Value for Spearman's rho
results$spearman
#> [1] 0.9811719
#Value for Kendall's tau
results$kendall
#> [1] 0.8719117
#Value for Blum-Kiefer-Rosenblatt R (or Schweizer-Wolff sigma_2)
results$bkr
#> [1] 0.9768168
#Value for Dette-Siburg-Stoimenov r (or Chatterjee's xi)
results$dss
#> [1] 0.8237094
#Value for Trutschnig's zeta_1
results$zeta1
#> [1] 0.9039916Please note that the choice of bandwidth
library(RDM)
n <- 500
x1 <- runif(n)
X <- cbind(x1, 0.5*sin(4*pi*x1)+0.5)
#Use a cross-validation principle to determine appropriate bandwidth choices
rdm(X, method="spearman", bandwidth_method="cv", bandwidth_parameter = c(0.25, 0.5))
#> [1] 0.975702Strothmann, C. 2021. “Extremal and Functional Dependence Between Continuous Random Variables.” Dissertation, TU Dortmund. https://doi.org/10.17877/DE290R-22733.
Strothmann, C., H. Dette, and K. F. Siburg. 2022. “Rearranged Dependence Measures.” https://arxiv.org/abs/2201.03329.
This package uses a modified version of code.cpp from the R-package “qad”, version 1.0.4, available under the GPL-2 license at https://cran.r-project.org/package=qad. For more information see the file “DESCRIPTION” and for a list of incorporated changes, please refer to src/code.cpp.
