network_to_path: Path model from ordered precision matrix

View source: R/network_to_path.R

network_to_pathR Documentation

Path model from ordered precision matrix

Description

Takes a precision matrix and generates a lower-triangular weights matrix.

Usage

network_to_path(omega, input_type = "precision", digits = 20)

Arguments

omega

input matrix, with rows and columns in desired topological ordering Must be an invertible square matrix

input_type

specifies what type of matrix 'omega' is. default is "precision", other options include a matrix of partial correlations ("parcor") or a covariance matrix "covariance"

digits

desired rounding of the output matrix

Value

lower triangular matrix containing regression weights of the path model. Element ij represents the effect of X_j on X_i

References

\insertRef

ryan2019SEset

\insertRef

shojaie2010penalizedSEset

\insertRef

bollen89semSEset

See Also

network_to_SEset

Examples

data(riskcor)
omega <- (qgraph::EBICglasso(riskcor, n = 69, returnAllResults = TRUE))$optwi
# qgraph method estimates a non-symmetric omega matrix, but uses forceSymmetric to create
# a symmetric matrix (see qgraph:::EBICglassoCore line 65)
omega <- as.matrix(Matrix::forceSymmetric(omega)) # returns the precision matrix

B <- network_to_path(omega, digits=2)

# Path model can be plotted as a weighted DAG
pos <- matrix(c(2,0,-2,-1,-2,1,0,2,0.5,0,0,-2),6,2,byrow=TRUE)

# qgraph reads matrix elements as "from row to column"
# regression weights matrices are read "from column to row"
# path model weights matrix must be transposed for qgraph
qgraph::qgraph(t(B), labels=rownames(riskcor), layout=pos,
repulsion=.8, vsize=c(10,15), theme="colorblind", fade=FALSE)


SEset documentation built on March 18, 2022, 5:51 p.m.