Partial Correlation

Partial correlation

This package provides a function for computing the partial correlation directly and another for testing the hypothesis of zero partial correlation using the HypothesisTests framework.

Partial correlation is a generalization of correlation to conditional distributions; it's akin to Pearson's correlation, substituting conditional variances and covariances in the computation. It can be thought of as the correlation between two random variables for the subpopulation defined by the conditional variable(s).

API

partialcor(x, y, Z)

Compute the partial correlation of the vectors x and y given Z, which can be a vector or matrix.

source
PartialCorTest(x, y, Z)

Perform a t-test for the hypothesis that $\text{Cor}(x,y|Z=z) = 0$, i.e. the partial correlation of vectors x and y given the matrix Z is zero.

Implements pvalue and confint. See also partialcor.

source