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)