cor_to_pcor: Correlation Matrix to (Semi) Partial Correlations
Description
Convert a correlation matrix to a (semi)partial correlation matrix. Partial
correlations are a measure of the correlation between two variables that
remains after controlling for (i.e., "partialling" out) all the other
relationships. They can be used for graphical Gaussian models, as they
represent the direct interactions between two variables, conditioned on all
remaining variables. This means that the squared partial correlation between
a predictor X1 and a response variable Y can be interpreted as the proportion
of (unique) variance accounted for by X1 relative to the residual or
unexplained variance of Y that cannot be accounted by the other variables.
Usage
cor_to_pcor(cor, tol = .Machine$double.eps^(2/3))
pcor_to_cor(pcor, tol = .Machine$double.eps^(2/3))
cor_to_spcor(cor = NULL, cov = NULL, tol = .Machine$double.eps^(2/3))
Arguments
cor, pcor
A correlation matrix, or a partial or a semipartial
correlation matrix.
tol
Relative tolerance to detect zero singular values.
cov
A covariance matrix (or a vector of the SD of the variables).
Required for semi-partial correlations.
Value
The (semi) partial correlation matrix.
Details
The semi-partial correlation is similar to the partial correlation statistic.
However, it represents (when squared) the proportion of (unique) variance
accounted for by the predictor X1, relative to the total variance of Y. Thus,
it might be seen as a better indicator of the "practical relevance" of a
predictor, because it is scaled to (i.e., relative to) the total variability
in the response variable.