rcdknn: Calculate robust copula dependence with the KNN estimator

Description Usage Arguments Value Examples

View source: R/rcdknn.R

Description

This is the function that used to calculate the robust copula dependence (RCD) between two random variables x and y with the KNN estimator. Note that the length of x and y should be the same.

Usage

1
rcdknn(x, y, k, cpp = "parallel")

Arguments

x

The sampled data, a vector, for the first random variable

y

The sampled data, a vector, for the second random variable

k

The parameter K in KNN that need to be used in the density estimation. This parameter could be missing and a deault value will be applied.

cpp

The ways to calculate the distance matrix. "none" means using R distance function, "serial" means using serial version of Rcpp, "parallel" means using parallel version of Rcpp.

Value

The RCD of x and y

Examples

1
2
3
4
n <- 1000
 x <- runif(n)
 y <- x^2 + 2*runif(n)
 rcdknn(x,y)

liyi-1989/rcd documentation built on May 21, 2019, 7:32 a.m.