Seeming disconnect between lavaan.mi() and lavResiduals.mi() re: NPD vcov

47 views
Skip to first unread message

Bryan Stiles

unread,
Apr 16, 2025, 9:05:46 PM4/16/25
to lavaan
Hello,

I am estimating the latent correlation between two measurement models on multiple imputed datasets: one with a two-factor model ("pos" and "neg") and another with only one factor. I am ultimately interested in the pos-swl and neg-swl factor correlations. As displayed below, I am using cfa.mi() to accomplish this:

sc.swl.1 <- '#specifying measurement model portion
pos  =~ NA*SCS_SF_q2 + SCS_SF_q5 + SCS_SF_q10  + SCS_SF_q3 + SCS_SF_q7
neg =~ NA*SCS_SF_q11 + SCS_SF_q4 + SCS_SF_q8 + SCS_SF_q1 + SCS_SF_q9
pos ~~ 1*pos
neg ~~ 1*neg

swl =~ NA*SWLS_q1 + SWLS_q2 + SWLS_q3 + SWLS_q4 + SWLS_q5
swl ~~ 1*swl

#specifying structural model portion
  pos ~~ swl
  neg ~~ swl'
sc.swl.1.out = sem.mi(sc.swl.1, data=imp2final, ordered=c("SCS_SF_q1", "SCS_SF_q2", "SCS_SF_q3", "SCS_SF_q4", "SCS_SF_q5", "SCS_SF_q7", "SCS_SF_q8", "SCS_SF_q9", "SCS_SF_q10", "SCS_SF_q11", "SWLS_q1", "SWLS_q2", "SWLS_q3", "SWLS_q4", "SWLS_q5"), estimator = "WLSMV", std.lv = TRUE)
summary(sc.swl.1.out, standardized = TRUE, rsquare=TRUE, fit.measures = TRUE) 


The output indicates it ran fine with no accompanying warnings: 

> summary(sc.swl.1.out, standardized = TRUE, rsquare=TRUE, fit.measures = TRUE)
lavaan.mi object fit to 20 imputed data sets using:
 - lavaan    (0.6-19)
 - lavaan.mi (0.1-0)
See class?lavaan.mi help page for available methods.

Convergence information:
The model converged on 20 imputed data sets.
Standard errors were available for all imputations.


  Estimator                                       DWLS
  Optimization method                           NLMINB
  Number of model parameters                        88

  Number of observations                           170
 
But, when I consult my correlation residual and standardized residual matrices with lavResiduals.mi(), I get 22 warning messages saying this repeatedly: 

There were 22 warnings (use warnings() to see them)
> warnings()
Warning messages:
1: lavaan->lav_model_vcov():  
   The variance-covariance matrix of the estimated parameters (vcov) does not appear to be positive definite! The smallest eigenvalue (= -2.644786e-18) is smaller than zero. This may be a symptom that the model is not identified.

I consulted vcov() but not sure if that is helping to diagnose the problem. I read on Stack Overflow (https://stackoverflow.com/questions/69911717/cfa-in-r-the-variance-covariance-matrix-of-the-estimated-parameters-vcov-does) that this might instead be a "warning about possible linear dependencies (redundancies) among some combination of model parameters." But that in lieu of no identification issues (which I don't think is the problem with my SEM), this might also reflect issues with my sample size and using DWLS. 

I am wondering about the seeming disconnect between the okay output from lavaan.mi() with no indication of NPD and the nature of the warning messages popping up when lavResiduals.mi()is called. Want to make sure I'm not missing a major red flag with the model. 

Thanks,
Bryan

Jeremy Miles

unread,
Apr 17, 2025, 12:47:00 AM4/17/25
to lav...@googlegroups.com
I'm not super familiar with the cfa.mi(), but is it possible it's just not reporting the NPD matrix of coefficients?

If the model is not identified that is a problem, but diagnosing whether a model is identified in software is not always straightforward (or possible). The way to tell is to run the model with different starting values (be sure to set the same seed if using something like imputation) - if it converges to different values, the model is not identified and that's a problem. If it converges to the same results, you're probably OK.

But that is a pretty small sample for DWLS.

Hope that helps, at least a little,

Jeremy


--
You received this message because you are subscribed to the Google Groups "lavaan" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lavaan+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/lavaan/eae45df4-5a02-4b24-9b50-0796e7dff70bn%40googlegroups.com.

Bryan Stiles

unread,
Apr 17, 2025, 4:22:42 PM4/17/25
to lavaan
Hi Jeremy, thank you for your advice on this. I'll look into your suggestion of different starting values.

I also found a thread from 2023 in which Dr. Jorgensen suggested a couple more steps beyond what I did w/ vcov() to evaluate whether any of the correlations of the estimated parameters are approaching or exceeding 1 (https://groups.google.com/g/lavaan/c/ezD32UE0FZk/m/qEwEEShaEwAJ). I took a look at this using similar syntax, and didn't find anything of concern; the highest correlations were ~.70 between some thresholds, but nothing larger than this. As suggested elsewhere on here (https://groups.google.com/g/lavaan/c/4y5pmqRz4nk), I wonder if this is a "machine-precision" issue given how close the eigenvalues are to zero. I appreciate how difficult this can be to diagnose. 

Bryan
Reply all
Reply to author
Forward
0 new messages