pdcor.Rd
Partial distance correlation pdcor, pdcov, and tests.
pdcov.test(x, y, z, R)
pdcor.test(x, y, z, R)
pdcor(x, y, z)
pdcov(x, y, z)
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
.
Argument types supported are numeric data matrix, data.frame, tibble, numeric vector, class "dist" object, or factor. For unordered factors a 0-1 distance matrix is computed.
Each test returns an object of class htest
.
Szekely, G.J. and Rizzo, M.L. (2014), Partial Distance Correlation with Methods for Dissimilarities. Annals of Statistics, Vol. 42 No. 6, 2382-2412.
n = 30
R <- 199
## mutually independent standard normal vectors
x <- rnorm(n)
y <- rnorm(n)
z <- rnorm(n)
pdcor(x, y, z)
#> pdcor
#> -0.04653524
pdcov(x, y, z)
#> [1] -0.01763282
set.seed(1)
pdcov.test(x, y, z, R=R)
#>
#> pdcov test
#>
#> data: replicates 199
#> n V^* = -0.52898, p-value = 0.85
#> sample estimates:
#> pdcor
#> -0.04653524
#>
set.seed(1)
pdcor.test(x, y, z, R=R)
#>
#> pdcor test
#>
#> data: replicates 199
#> pdcor = -0.046535, p-value = 0.85
#> sample estimates:
#> pdcor
#> -0.04653524
#>
# \donttest{
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))
}
#>
#> pdcov test
#>
#> data: replicates 199
#> n V^* = 12.29, p-value = 0.005
#> sample estimates:
#> pdcor
#> 0.6850001
#>
#>
#> pdcov test
#>
#> data: replicates 199
#> n V^* = 0.45494, p-value = 0.105
#> sample estimates:
#> pdcor
#> 0.05892834
#>
# }