Thin extender over ppcor::pcor (matrix-wise) or
ppcor::pcor.test (when y and z are
supplied) for partial correlations controlling for one or more
variables.
Arguments
- x
Numeric vector, matrix, or data frame. When
yandzareNULL, the full pairwise partial correlation matrix is returned viappcor::pcor.- y
Optional second numeric vector.
- z
Optional numeric vector / matrix of control variables.
- method
Correlation method (
"pearson","spearman", or"kendall"), forwarded to ppcor.- ...
Further arguments forwarded to the upstream function.
Examples
if (requireNamespace("ppcor", quietly = TRUE)) {
set.seed(1)
x <- rnorm(40); z <- rnorm(40); y <- x + z + rnorm(40)
morie_ppcor_partial(x, y, z)
}
#> $method
#> [1] "partial_cor_test (rmorie native)"
#>
#> $raw
#> estimate p.value statistic n gp Method
#> 1 0.6045424 4.58353e-05 4.616385 40 1 pearson
#>
