covariance matrix of latent variables is not positive definite in one of the MI groups

119 views
Skip to first unread message

Nikola Ćirović

unread,
Nov 17, 2024, 5:30:36 PM11/17/24
to lavaan
 Hello everyone,
I have an issue that is already raised by some posts but I cannot seem to find the answer that fits my situation.
Namely, in running measurement invariance analysis across gender (male(small group) VS. female (large group)) I came across the following warning:

covariance matrix of latent variables is not positive definite in group 2; use
   lavInspect(fit, "cov.lv") to investigate. 

Now, the lavInspect command yielded the following results:

$`2` (male group - the one with the problem) Future Prsn_C Strctr Harmny Goals Future 1.000 Personal_Control 0.861 1.000 Structure 0.662 0.588 1.000 Harmony 0.706 0.866 0.672 1.000 Goals 0.880 0.975 0.547 0.743 1.000 $`1` Future Prsn_C Strctr Harmny Goals Future 1.000 Personal_Control 0.882 1.000 Structure 0.675 0.868 1.000 Harmony 0.850 0.913 0.731 1.000 Goals 0.882 0.902 0.617 0.682 1.000

As you can see, some latent correlations are pretty high but not as high as 1 (or more). Also, there are no Heywood cases in the output.

Aa I understood Professor Jorgensen's comments on previous similar
posts - this may not even be a problem. But how does one explain (or fix) this?

Kind regards,
Nikola

Edward Rigdon

unread,
Nov 17, 2024, 6:13:40 PM11/17/24
to lav...@googlegroups.com
     I would guess that the 0.975 between Personal Control and Future is the problem. You say n is small, but how small? Small enough that the confidence interval around that 0.975 includes 1.000? It just may be that n is so small that the determinant for this correlation matrix is too close to 0 to discern the difference. That high value could be the evidence against invariance that you are looking for. Maybe the observed variables don't discriminate well for the Male respondents.

On Sun, Nov 17, 2024 at 5:30 PM Nikola Ćirović <nikola.v....@gmail.com> wrote:
 Hello everyone,
I have an issue that is already raised by some posts but I cannot seem to find the answer that fits my situation.
Namely, in running measurement invariance analysis across gender (male(small group) VS. female (large group)) I came across the following warning:

covariance matrix of latent variables is not positive definite in group 2; use
   lavInspect(fit, "cov.lv") to investigate. 

Now, the lavInspect command yielded the following results:

$`2` (male group - the one with the problem)
 
Future Prsn_C Strctr Harmny Goals Future 
1.000 
0.861 1.000
0.662 0.588 1.000
0.706 0.866 0.672 1.000
0.880 0.975 0.547 0.743 1.000
 
1.000
0.882 1.000
0.675 0.868 1.000
0.850 0.913 0.731 1.000
0.882 0.902 0.617 0.682 1.000

As you can see, some latent correlations are pretty high but not as high as 1 (or more). Also, there are no Heywood cases in the output.

Aa I understood Professor Jorgensen's comments on previous similar
posts - this may not even be a problem. But how does one explain (or fix) this?

Kind regards,
Nikola

--
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/28c17768-a40b-4927-8ab2-e3fb6ad84585n%40googlegroups.com.

Nikola Ćirović

unread,
Nov 17, 2024, 6:28:25 PM11/17/24
to lavaan
Dear Professor, 
Thank you for your response.
I also believe this high correlation might be the problem and yes n is 80 participants in this group so the CI is probably encompassing 1 (I am not sure how to check this).
I do not quite understand your comment on the implications for measurement invariances (the lack thereof) of this problem. 
The model fits well in both groups separately (even better in the male/small group). The test has only 15 items.
What do you think is the solution?

Shu Fai Cheung (張樹輝)

unread,
Nov 17, 2024, 7:35:10 PM11/17/24
to lavaan
> The model fits well in both groups separately (even better in the male/small group). The test has only 15 items.

Interesting. You mentioned that you were doing measurement invariance analysis. At which stage did that warning occur? if the model fits well when analyzed in each group separately, then I guess you did not have that warning when fitting a configural invariance model.

-- Shu Fai

Nikola Ćirović

unread,
Nov 17, 2024, 7:56:38 PM11/17/24
to lavaan
Dear Professor  Shu Fai,
Thank you for your response. Actually, the warning appears in the configural model (and persists throughout). It also appears when I do a separate analysis in the male sample again with no Heywood cases (same as in the configural model).

Chris Evans

unread,
Nov 18, 2024, 2:19:05 AM11/18/24
to lav...@googlegroups.com


On 18/11/2024 00:28, Nikola Ćirović wrote:
Dear Professor, 
Thank you for your response.
I also believe this high correlation might be the problem and yes n is 80 participants in this group so the CI is probably encompassing 1 (I am not sure how to check this).

One of my little shiny apps, specifically https://shiny.psyctc.org/apps/CIcorrelation/ will give you that for the Gaussian population model and a says that the 95% CI around an observed .975 with n = 80 is from .96 to .98. That looks clear of 1.00.  I'm not an expert in measurement invariance to know if that helps you here, I think others are answering that as ever on this list.

I couldn't resist the opportunity to give my shiny apps a plug here.  And, shamelessly, while I'm here, people interested in the overlaps of psychology, mental health and the psychotherapies might find the apps useful and might also find useful things in my online glossary, 326 entries and climbing mostly about quantitative things in that area, and in my Rblog, 50 entries and climbing, which expands on some topics in the glossary.  All free to use and content in Creative Commons open licence.

Also while I'm here: huge thanks to all who regularly contribute to this list: I have found it hugely useful and educative and the spirit of the contributions impressively generous and supportive.

Chris


To view this discussion visit https://groups.google.com/d/msgid/lavaan/4c1f1cd7-d593-42ae-b385-6a0e79bead7fn%40googlegroups.com.
--
Chris Evans (he/him)
Visiting Professor, UDLA, Quito, Ecuador
CORE site: http://www.coresystemtrust.org.uk
Other work web site: https://www.psyctc.org/psyctc/
Personal site: https://www.psyctc.org/pelerinage2016/
Emeetings (Thursdays): https://www.psyctc.org/psyctc/booking-meetings-with-me/
(Beware: French time, generally an hour ahead of UK)

Nikola Ćirović

unread,
Nov 18, 2024, 12:18:15 PM11/18/24
to lavaan
Dear Chris,
Thank you for this resource! It will be useful for me in general.
However, I am confused now as to what is the problem with the warning I got (the SE of this particular correlation is .043).
I would be thankful to anyone who could suggest me a paper form research literature (methods) on this topic.
KInd regards,
Nikola

Chris Evans

unread,
Nov 18, 2024, 12:33:14 PM11/18/24
to lav...@googlegroups.com

[oops, I saw the reply to me before the reply to the list. To keep things open, this is what I sent to Nikola.

On 18/11/2024 18:15, Nikola Ćirović wrote:
Dear Chris,
Thank you for this app. It will be useful for me in many respects!
I do hope these things I'm putting out there come in useful to people.
However, I am now confused as to what is the problem with the warning I got (also, the SE of this correlation is .043).
That sounds to fit with the 95% CI my app is giving.  Perhaps I will add output of the SE to the app.
I would be very thankful if anyone could recommend me some piece of methods literature about this problem.

I'm sorry, I'm really not an expert on this, there are real experts on the list (of course!) I hope you get some more help there but I suspect that the consensus would be that it's not a fatal error but a warning.  However, really I shouldn't even be trying to give you a view given my lack of specific expertise!

Where I am a bit more expert is in simulating these sorts of things.  You could try simulating sets of samples of the same size as you had drawing on a population model based on a pooled correlation matrix from your real samples and then doing the analysis for each of the simulations.  With the power of modern hardware and the efficiency of lavaan I suspect that this is entirely possible even if might need to be left running overnight.  You could then look at the distributions of the parameters for each fit and of the fit indices and you could collect up the prevalence of errors and warnings.

However, I hope you get more expert answers from the list.

Very best wishes,

Chris

Shu Fai Cheung (張樹輝)

unread,
Nov 18, 2024, 1:04:17 PM11/18/24
to lavaan
May I ask one quick question? Is the following correlation matrix among latent variables the one with the warning?


1.000
0.882 1.000
0.675 0.868 1.000
0.850 0.913 0.731 1.000
0.882 0.902 0.617 0.682 1.000


I previously thought that it was the one with a correlation of .975. But I checked and it is the second correlation matrix that is not positive definite. However, I may be wrong due to rounding errors.

I think the problem is more a theoretical one than an SEM one. Even if you got no warning, it is not easy to adopt a model with factor correlations so high (.8 to .9). Is this the measurement model step and do you plan to test a structural model? If this is the case, then the high correlations "may" be meaningful because they reflect strong effects from some factors to other factors. But they may also suggest multicollinearity among the factors.

Putting aside the issue of high correlations, if you just want to remove the warning legitimately, one possible solution came to my mind. Given that the warning is not for the large sample, if theoretically justifiable, you can try constraining the factor variances and covariances to be equal between the two groups (after you have constrained other parameters, such as factor loadings). If this model is so-called true, then the factor variances and covariances estimate the common factor variances and covariances, using data from both samples. (Yes, this is unlikely to be absolutely true ... but many models are approximations and not absolutely true.)

Certainly, this requires that it is theoretically meaningful to impose the constraints. Moreover, there is no guarantee that this can solve the problem, given the large factor correlations in both samples.

-- Shu Fai

Nikola Ćirović

unread,
Nov 21, 2024, 4:26:17 PM11/21/24
to lavaan

Dear all, 
First of all - thank you for taking part in this discussion. 
Secondly, lavaan has me confused about which group is the one with the non-positive latent covariance matrix. Here is the output part.

> fit.model.factorFIScon <- cfa (factorFIS4, data =InsideMe_identitet_SVE_sirovo_sredjeno,

+                                std.lv=T,  estimator='mlr', group="pol", missing= 'fiml')

Warning messages:

1: lavaan->lav_data_full():  

   group variable ‘pol’ contains missing values 

2: lavaan->lav_object_post_check():  

   covariance matrix of latent variables is not positive definite in group 2; use 

   lavInspect(fit, "cov.lv") to investigate. 


> summary(fit.model.factorFIScon,

+         fit.measures = TRUE,

+         standardize = TRUE, 

+         rsquare = TRUE)

lavaan 0.6-19 ended normally after 83 iterations

  Estimator                                         ML

  Optimization method                           NLMINB

  Number of model parameters                       114

  Number of observations per group:                   

    2                                              301 (female group)

    1                                               80 (male group)

  Number of missing patterns per group:               

    2                                                5

    1                                                1


As you can see, lavaan lists the groups in the reverse order and tells me that the group 2 is a problem. Which one is it then?

Dear Professor Shu Fai, here are the correlational matrices again:

> lavInspect(fit.model.factorFIScon, "cov.lv")
$`2`
                                 Future Prsn_C Strctr Harmny Goals
Future                     1.000                           
Personal_Control  0.861  1.000                    
Structure                0.662  0.588  1.000             
Harmony                0.706  0.866  0.672  1.000      
Goals                      0.880  0.975  0.547  0.743 1.000

$`1`
                                  Future Prsn_C Strctr Harmny Goals
Future                      1.000                           
Personal_Control   0.882  1.000                    
Structure                 0.675  0.868  1.000             
Harmony                 0.850  0.913  0.731  1.000      
Goals                       0.882  0.902  0.617  0.682 1.000

An answer to your question - no, we are only testing the measurement model - it is a scale adaptation paper. And yes, there is definitely a multicollinearity issue here. We will deal with this theoretically in the paper as this instrument's limitation (following your suggestion that this is a theoretical rather than a SEM issue). Thank you for this.
 Finally, yes - when we constrained the factor variances and covariances - the warning disappeared and the fit did not decrease more than suggested by Cheung and Rensvold to indicate the lack of this particular invariance type. But how do I explain this in terms of the problem we had? Thank you for this excellent suggestion!

Chris, thank you , too.
Kind regards, 
Nikola 
Reply all
Reply to author
Forward
0 new messages