Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sdpcor2cov

sdcor2cov


Description

Converts a lower triangular matrix with standard deviations on the diagonal and partial correlations on lower triangle, to a covariance (or cholesky decomposed covariance)

Usage

sdpcor2cov(mat, coronly = FALSE, cholesky = FALSE)

Arguments

mat

input square matrix with std dev on diagonal and lower tri of partial correlations.

coronly

if TRUE, ignores everything except the lower triangle and outputs correlation.

cholesky

Logical. To return the cholesky decomposition instead of full covariance, set to TRUE.

Examples

testmat <- diag(exp(rnorm(5,-3,2)),5) #generate arbitrary std deviations
testmat[row(testmat) > col(testmat)] <- runif((5^2-5)/2, -1, 1) 
print(testmat)
covmat <- sdpcor2cov(testmat) #convert to covariance
cov2cor(covmat) #convert covariance to correlation

ctsem

Continuous Time Structural Equation Modelling

v3.4.3
GPL-3
Authors
Charles Driver [aut, cre, cph], Manuel Voelkle [aut, cph], Han Oud [aut, cph], Trustees of Columbia University [cph]
Initial release
2021-04-20

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.