Error when using a variance-covariance matrix as input for lavaan/SEM module
Has anyone out there successfully run a SEM model in JASP using a variance-covariance matrix as input?
The raw data input seems to work fine, but when I try using a covariance matrix input, I keep getting an error that lavaan crashed:
"Error in lav_samplestats_from_moments(sample.cov = sample.cov, sample.mean = sample.mean, : lavaan ERROR: rownames of covariance matrix do not match the model! found: 1 2 3 4 5 6 expected: VAR1 VAR2 VAR3 VAR4 VAR5 VAR6."
VAR1-6 are my variable names, which are listed in the top row of a .csv file (attached). Does the file need to be formatted a different way for the variable labels to apply to the matrix rows in lavaan? When I also include the labels vertically in the first column of the datafile, it tells me that "Dataset is not a proper variance-covariance matrix.".
Everything seems to work fine until running the model syntax. Has this worked for anyone, or could it be a bug in the JASP implementation of lavaan's covariance input?
Thanks,
Ben
Comments
Hi Ben,
I'll forward this to our SEM team member (who is on vacation right now). Thanks for reporting this.
Cheers,
E.J.
Hi Ben,
This is indeed currently a bug in our software. We will fix this ASAP. If you tell me the sample size of your data, I can generate a dataset for you which will create the exact results you would get with the covariance matrix.
Erik-Jan