lavaan gives you a warning message about which matrix is nonpositive definite, and the message also tells you how to investigate it (using the
inspect() function -- which has actually been superseded by the
lavInspect() function). If your lavaan object is called "
fit" and the error message was about the latent variable covariance matrix, then you could inspect it like this:
lavInspect(fit, what = "cov.lv")
A negative value on the diagonal would be an out-of-bounds estimated variance, making it nonpositive definite. If the problem is a correlation being beyond +/- 1, then you can find it looking at the correlation matrix:
lavInspect(fit, what = "cor.lv")
Look at the ?lavInspect help page to see what else you can look up.
Terry