Dear all,
I am trying to run a SEM. I measured two variables (ABB and PSWQ) at two occasions (t0 and t4) and have one binary covariate (group).
This is how I specified my model so far.
modelPSWQ <- '
#measurement model
ABBlog.0 =~ A302.0 + A303.0 + A304.0 + A305.0 + A306.0
ABBlog.4 =~ A302.4 + A303.4 + A304.4 + A305.4 + A306.4
PSWQ.0 =~ A502_01.0 + A502_02.0 + A502_03.0 + A502_04.0
PSWQ.4 =~ A502_01.4 + A502_02.4 + A502_03.4 + A502_04.4
#latent model
ABBlog.4 ~ a*ABBlog.0
PSWQ.4 ~ p*PSWQ.0
ABBlog.0 ~ b*PSWQ.0
ABBlog.4 ~ c*PSWQ.4
ABBlog.4 ~ g*group
PSWQ.4 ~ h*group
#indirect effect
hc := h*c
#total effect EAP
total := g + (h*c)
# variances and covariances
ABBlog.0 ~~ ABBlog.0
ABBlog.4 ~~ ABBlog.4
PSWQ.0 ~~ PSWQ.0
PSWQ.4 ~~ PSWQ.4
ABBlog.0 ~~ ABBlog.4
PSWQ.0 ~~ PSWQ.4'
However, if I test the model:
fit <- sem(modelPSWQ, data=ds_wide)
I get the error:
"Error in lav_samplestats_icov(COV = cov[[g]], ridge = ridge, x.idx = x.idx[[g]], :
lavaan ERROR: sample covariance matrix is not positive-definite"
From my research so far I figured that this error probably occurs because some of my variables/items are covarying too high.
Still, it is logical that the same item, measured at two measurement points, has high covariance.
Do I get the error right? If so, how can I change the specifications of my model without deleting items/variables, as the high covariance is not an error in the data (I checked the covariance/correlation matrix of my model and there are no implausible values)?
Or is there an error in my model/code?
Thank you very much for your help!