I am trying to run a mediation model examining country group differences in impression management. I am having some difficulty diagnosing the problem in my lavaan model.
I have three groups: country A (n = 300), country B (n = 325), and country C (n = 320), which are dummy coded into variables A and B.
I specified my mediation model as follows:
model<- '#Imp Mgmt Styles Factor
sprom =~ IM_Sup08+IM_Pr28+IM_Sup27+IM_Pr08+IM_Pr28+IM_Pr27+IM_Sub08+IM_Sub28+IM_Sub27
ingrt =~ IM_Sup14+IM_Sup15+IM_Sup19+IM_Pr14+IM_Pr15+IM_Pr19+IM_Sub14+IM_Sub15+IM_Sub19
exemp =~ IM_Sup06+IM_Sup07+IM_Sup29+IM_Pr06+IM_Pr07+IM_Pr29+IM_Sub06+IM_Sub07+IM_Sub29
#Target Factor
super =~ IM_Sup08+IM_Sup28+IM_Sup27+IM_Sup14+IM_Sup15+IM_Sup19+IM_Sup06+IM_Sup07+IM_Sup29
peer =~ IM_Pr08+IM_Pr28+IM_Pr27+IM_Pr14+IM_Pr15+IM_Pr19+IM_Pr06+IM_Pr07+IM_Pr29
sub =~ IM_Sub08+IM_Sub28+IM_Sub27+IM_Sub14+IM_Sub15+IM_Sub19+IM_Sub06+IM_Sub07+IM_Sub29
#Predictors
sprom ~ TrnvPssb
ingrt ~ TrnvPssb
exemp ~ TrnvPssb
super ~ TrnvPssb
peer ~ TrnvPssb
sub ~ TrnvPssb
TrnvPssb ~ A + B'
fit<-cfa(model = model, std.lv = TRUE, data = dt, estimator = "WLSMV")
When I attempt to run it, I get the error lavaan ERROR: sample covariance matrix is not positive-definite
. I have dismantled and tested every other part of the model so I know that the problem is not with the other parts of the model. In fact, I can run it with just one of the dummy-coded variables (A or B) and it works perfectly.
I wonder if it is a shared variance issue with the grouping variable. How would I be able to test this and fix it?
Thank you for sharing your knowledge and expertise.