pdcor: Partial distance correlation and covariance

Description Usage Arguments Details Value Author(s) References Examples

View source: R/pdcor.R

Description

Partial distance correlation pdcor, pdcov, and tests.

Usage

1
2
3
4
  pdcov.test(x, y, z, R)
  pdcor.test(x, y, z, R)
  pdcor(x, y, z)
  pdcov(x, y, z)

Arguments

x

data matrix or dist object of first sample

y

data matrix or dist object of second sample

z

data matrix or dist object of third sample

R

replicates for permutation test

Details

pdcor(x, y, z) and pdcov(x, y, z) compute the partial distance correlation and partial distance covariance, respectively, of x and y removing z.

A test for zero partial distance correlation (or zero partial distance covariance) is implemented in pdcor.test, and pdcov.test.

If the argument is a matrix, it is treated as a data matrix and distances are computed (observations in rows). If the arguments are distances or dissimilarities, they must be distance (dist) objects. For symmetric, zero-diagonal dissimilarity matrices, use as.dist to convert to a dist object.

Value

Each test returns an object of class htest.

Author(s)

Maria L. Rizzo mrizzo @ bgsu.edu and Gabor J. Szekely

References

Szekely, G.J. and Rizzo, M.L. (2014), Partial Distance Correlation with Methods for Dissimilarities. Annals of Statistics, Vol. 42 No. 6, 2382-2412.

Examples

 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
  n = 30
  R <- 199

  ## mutually independent standard normal vectors
  x <- rnorm(n)
  y <- rnorm(n)
  z <- rnorm(n)

  pdcor(x, y, z)
  pdcov(x, y, z)
  pdcov.test(x, y, z, R=R)
  print(pdcor.test(x, y, z, R=R))


if (require(MASS)) {
  p = 4
  mu <- rep(0, p)
  Sigma <- diag(p)

  ## linear dependence
  y <- mvrnorm(n, mu, Sigma) + x
  print(pdcov.test(x, y, z, R=R))

  ## non-linear dependence
  y <- mvrnorm(n, mu, Sigma) * x
  print(pdcov.test(x, y, z, R=R))
  }

Example output

     pdcor 
0.03380488 
[1] 0.0109811

	pdcov test

data:  replicates 199
n V^* = 0.32943, p-value = 0.235
sample estimates:
     pdcor 
0.03380488 


	pdcor test

data:  
pdcor = 0.033805, p-value = 0.205
sample estimates:
     pdcor 
0.03380488 

Loading required package: MASS

	pdcov test

data:  replicates 199
n V^* = 12.376, p-value = 0.005
sample estimates:
    pdcor 
0.6372653 


	pdcov test

data:  replicates 199
n V^* = 1.7541, p-value = 0.005
sample estimates:
    pdcor 
0.2285614 

energy documentation built on Feb. 22, 2021, 5:08 p.m.