cdcov: Conditional Distance Covariance/Correlation Statistics

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/cdcov.R

Description

Computes conditional distance covariance and conditional distance correlation statistics, which are multivariate measures of conditional dependence.

Usage

1
2
3
cdcov(x, y, z, width, index = 1, distance = FALSE)

cdcor(x, y, z, width, index = 1, distance = FALSE)

Arguments

x

a numeric vector, matrix, or dist object

y

a numeric vector, matrix, or dist object

z

z is a numeric vector or matrix. It is the variable being conditioned.

width

a user-specified positive value (univariate conditional variable) or vector (multivariate conditional variable) for gaussian kernel bandwidth. Its default value is relies on stats::bw.nrd0.

index

exponent on Euclidean distance, in (0,2]

distance

if distance = TRUE, x and y will be considered as distance matrices. Default: distance = FALSE.

Details

cdcov and cdcor compute conditional distance covariance and conditional distance correlation statistics. The sample sizes (number of rows or length of the vector) of the two variables must agree, and samples must not contain missing values. If we set distance = TRUE, arguments x, y can be a dist object recording distance between samples; otherwise, these arguments are treated as multivariate data.

Value

cdcov

conditional distance covariance test statistic.

cdcor

conditional distance correlation statistic.

cdc

conditional distance covariance/correlation vector.

Author(s)

Canhong Wen, Wenliang Pan, and Xueqin Wang

References

Wang, X., Pan, W., Hu, W., Tian, Y. and Zhang, H., 2015. Conditional distance correlation. Journal of the American Statistical Association, 110(512), pp.1726-1734.

See Also

cdcor

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(cdcsis)

############# Conditional Distance Covariance #############
set.seed(1)
x <- rnorm(25)
y <- rnorm(25)
z <- rnorm(25)
cdcov(x, y, z)
############# Conditional Distance Correlation #############
num <- 25
set.seed(1)
x <- rnorm(num)
y <- rnorm(num)
z <- rnorm(num)
cdcor(x, y, z)

Example output

    cdcov 
0.1017181 
    cdcor 
0.3051893 

cdcsis documentation built on July 10, 2019, 5:04 p.m.