u/DeliberateDendrite

How to generate a set of random covariance matrices with specific covariances? [Q]

For a Monte Carlo study I'm trying to generate a series of covariance matrices that have a specific range of covariances. I'm sampling the individual covariances and marginals from a set of theoretically likely covariances but I'm running into the problem that the combination of those does not result in a (semi-) positive definite covariance matrix. The R script I've set up returns to draw a new set of covariances and construct a new covariance matrix but even after 10000 attempts it does not seem to find a proper covariance matrix. This tells me I must be doing something wrong. I read that I might need to do a Cholesky decomposition, which would require me to rewrite and restructure my script. What's the best way to move forward?

Edit: I see now that a Cholesky decomposition itself requires a positive definite matrix..

reddit.com
u/DeliberateDendrite — 5 days ago

What packages do you all use to plot structural equation models? I'm currently working on a project where the plan is to incorporate path models in either scripts or a shiny app but so far, I haven't found a good package to do this from lavaan fit objects. The issue I'm running into is that a few of the models I'm trying to run are complex with five exogenous covariates and several (exogenous and endogenous) latent variables with mediated paths between them. Is there a way to plot those without having to write coordinate systems that at more complex than the models themselves?

reddit.com
u/DeliberateDendrite — 24 days ago