A small function that converts a precision matrix (inverse of covariance matrix) to a partial correlation matrix. This can be done by standardizing the precision matrix and changing the sign of the off-diagonal entries. Many methods exist for obtaining a precision matrix (such as the glasso package; Friedman, Hastie and Tibshirani, 2011) but the partial correlation matrix is easier to interpret and more usable in qgraph.
wi2net(x)A partial correlation matrix with diagonal set to zero, returned as a symmetric matrix of class dsyMatrix from the Matrix package (use as.matrix to convert to a base matrix)
A precision matrix
Sacha Epskamp <mail@sachaepskamp.com>
Jerome Friedman, Trevor Hastie and Rob Tibshirani (2011). glasso: Graphical lasso-estimation of Gaussian graphical models. R package version 1.7. http://CRAN.R-project.org/package=glasso