mdcov: Marginal distance covariance This function implements the...

Description Usage Arguments Examples

View source: R/mdcov.R View source: R/RcppExports.R

Description

Marginal distance covariance This function implements the method of calculating distance covariance between y and each column in x

Usage

1
2
3
mdcov(y, x, type = c("V", "U"))

mdcor(y, x, type = c("V", "U"))

Arguments

y

the matrix of y

x

the matrix of x, distance covariance is calculated for each variable in x with y.

type

"V" or "U", for V- or U-statistics of distance covariance or correlation. The default value is "V".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
n = 200; p = 10
y = matrix(rnorm(n*2),n,2)
x = matrix(rnorm(n*p),n,p)
res1 = mdcov(y,x)
res2 = numeric(p)
for(j in 1:p){res2[j] = dcov::dcov(y,x[,j])}
# res1 is same with res2
res1 - res2
res3 = mdcor(y,x)
res4 = numeric(p)
for(j in 1:p){res4[j] = dcov::dcor(y,x[,j])}
# res3 is same with res4
res3-res4

dcov documentation built on July 1, 2020, 6:20 p.m.

Related to mdcov in dcov...