ReadSymMatrixFromTriangle: Read in a symmetric matrix from a data file containing the triangle of the matrix and the main diagonal
Description
Produces a symmetric matrix (e.g., a covariance matrix) from a file that contains the triangle of the matrix and the main diagonal.
Structural equation modeling (SEM) programs often report model-implied covariance matrices
by reporting the lower triangle (containing covariances)
and the diagonal (containing variances).
Usage
ReadSymMatrixFromTriangle(file, n.vars)
Arguments
file
Path to data file containing the triangle and main diagonal of the matrix
n.vars
The number of number of rows and columns in the matrix (i.e., the number of variables)
Value
A symmetric matrix with n.vars rows and n.vars columns