2

I know it is possible to get the partial correlation between $a$ and $b$ given $c$ when you know all the full correlations:

$$ r_{(a, b |c)} = \frac{r_{(a, b)}-r_{(a, c)}r_{(b, c)}} {\sqrt{(1-r_{(a, c)}^2)((1-r_{(b, c)}^2)}} $$

Presumably we can get the full correlations when we know all the partials, but I can't figure out the equations. Is it possible?

2 Answers2

0

Partial correlation is the inverse of the covariance matrix... So Compute all the partials, write down the matrix and compute the inverse! :)

  • 1
    I like the nature of this answer but believe it's incomplete, because the inverse of a covariance matrix cannot, in general, possibly contain correlation coefficients. See https://en.wikipedia.org/wiki/Partial_correlation#Using_matrix_inversion. – whuber Jan 22 '20 at 23:23
  • I guess you are right... in general. Because the cov. matrix needs to be invertible. In this case you only have (a,b,c), so my guess is that if the cov. matrix is not invertible (for instance you have only 2 samples to work with), than also partial correlation will be 1. because the residuals you would get from the regression would be 0. – M. GENTILI Jan 23 '20 at 15:48
  • I read you post here, I have few questions, can I contact you? if so... how? – M. GENTILI Jan 23 '20 at 15:49
0

Some additional steps are necessary other than simply calculating the inverse. The actual steps are the following:

  • Step 1: Get the negative of the matrix of partial correlations;
  • Step 2: Set all the values in the diagonal of this new matrix to 1;
  • Step 3: Calculate the inverse of this matrix (i.e., the modified matrix of partial correlations where all the off-diagonal elements have the inverse sign of the original matrix of partial correlations);
  • Step 4: Scale the resulting inverse.

Below I present a reproducible example with R:

# Set seed for reproducibility
set.seed(1)

Randomly sample the original random correlation matrix

R <- cov2cor(rWishart(n=1, df=6, Sigma=diag(5))[,,1])

Get the partial correlation matrix using the "partial.r" function of the psych package

Rho <- psych::partial.r(R)

Do the steps described above

Step 1: Get the negative of the of matrix of partial correlations

temp <- -Rho

Step 2: Set all the values in the diagonal of this new matrix to 1

diag(temp) <- 1

Step 3: Calculate the inverse of the matrix

inv <- solve(temp)

Step 4: Scale the resulting inverse

R_rec <- cov2cor(inv)

Check if the solution is correct

Due to computer precision, the matrices will not be identical, but

you can round the results to your machine's precision and check

that the procedure works as it should

round(R, .Machine$double.eps) == round(R_rec, .Machine$double.eps)