Another problem with SEMLj

General help and assistance with jamovi. Bug reports can be made at our issues page: https://github.com/jamovi/jamovi/issues . (If you're unsure feel free to discuss it here)
Post Reply
Pauline88
Posts: 5
Joined: Fri Apr 29, 2022 3:50 pm

Another problem with SEMLj

Post by Pauline88 »

Hello,

First of all, thank you very much for Jamovi, which is doing me great services for my studies! Your work is fantastic!

I've done a SEM with no problems so far. But when I wanted to introduce a multigroup analysis factor, I systematically got an error message. I don't understand why it's not working. The error appears regardless of the induced variable (dichotomized or not). I join you a screenshot.

Jamovi is up to date on my computer (Linux).

Do you have any solution to help me?

Thanks very much !
Pauline
Attachments
Capture d’écran de 2022-04-29 17-54-33.png
Capture d’écran de 2022-04-29 17-54-33.png (219.19 KiB) Viewed 2097 times
User avatar
mcfanda@gmail.com
Posts: 462
Joined: Thu Mar 23, 2017 9:24 pm

Re: Another problem with SEMLj

Post by mcfanda@gmail.com »

Did you update the module to its last version? If the issue persists, it may be a problem with the model you're estimating. Try a simple model and check if you get the same issue
Pauline88
Posts: 5
Joined: Fri Apr 29, 2022 3:50 pm

Re: Another problem with SEMLj

Post by Pauline88 »

Thanks for your quick return !
It didn't work better with the module update, but I found a trick to solve the problem: I clicked on "Do not run" then I unchecked and since it works. I absolutely don't know why.
User avatar
mcfanda@gmail.com
Posts: 462
Joined: Thu Mar 23, 2017 9:24 pm

Re: Another problem with SEMLj

Post by mcfanda@gmail.com »

Hi
I'm glad you solved it. However, I'd like to ask you to share a .omv file in which we can reproduce the issue. The reason is that you get this issue because your intermediate model (before you finish setting it up) does not converge, and so the module returns an error. We can add more meaningful feedback for the user when this issue happens.
Pauline88
Posts: 5
Joined: Fri Apr 29, 2022 3:50 pm

Re: Another problem with SEMLj

Post by Pauline88 »

Hello,

My problem is not completely solved after all. When I want to put an equality constraint in my multi-group model, Jamovi calculates continuously (I let it run for more than 2 hours) and no result appears. Only "means" work. I attach my file in .omv. I hope it will be useful to you.

Thank you !
Pauline
Attachments
H1.omv
(141.02 KiB) Downloaded 73 times
User avatar
mcfanda@gmail.com
Posts: 462
Joined: Thu Mar 23, 2017 9:24 pm

Re: Another problem with SEMLj

Post by mcfanda@gmail.com »

Hi, thanks, but I do not see any semlj analysis in the file!
Pauline88
Posts: 5
Joined: Fri Apr 29, 2022 3:50 pm

Re: Another problem with SEMLj

Post by Pauline88 »

Sorry, I entered the wrong file :(

Here is the correct file, it contains twice the same SEM, an interactive version and a syntax version.

The file is a little too big to send to you directly, so I used We Transfer, hope you don't have a problem: https://we.tl/t-YpA5QHaOcG

You may be able to see that I managed to solve the multi-group issue with some variables (eg SEX) by clicking "Do not run" but it doesn't work for other variables (AGE for example) .

Thank you for everything.
User avatar
mcfanda@gmail.com
Posts: 462
Joined: Thu Mar 23, 2017 9:24 pm

Re: Another problem with SEMLj

Post by mcfanda@gmail.com »

Here is the issue: A SEM model does not necessarily work because the estimation algorithm should find a solution, and that is not guaranteed. It is not a matter of software, some models cannot be estimated given the data.

The first model seems to work but it actually fails, because you see that "Note. lavaan WARNING: some estimated lv variances are negative". Negative variances are not a possible solution, so you need to change the model (you can work on the covariances of observed variables, or try to fix some variance to zero, check the modification indexes: the options are endless in SEM). This issue belongs to the Heywood case list, you can check https://pubmed.ncbi.nlm.nih.gov/34197140/ for some advice).

When comparing multiple groups, things get worse, because the model should be estimable for all groups. For "SEXE", for instance, it seems to work (you get estimates) but in reality, you get negative variances here as well, so also here you need to refine your model.
For AGE, the model is simply not estimable, so it needs to be refined. When you see "sample covariances matrix is not positive-definite" it means that the model has some serious issues. There's a vast literature on how to tackle these issues, but it is something that the software cannot solve (if you run with other software, with the same options, you get the same issue).

The "do not run" option is not a solution. The only thing that it does is to hold the estimation until you finish setting up the model. So, if the intermediate model is not estimable but the final one works, it seems like you have solved the issue. In practice, it is better to stop and handle the issues as they arise building the model.

I'd suggest starting with a simple model and investigating an issue when arises (any warning you get is likely an issue with the model being estimated). When you have a model that works for the full sample, try checking the multi-group analysis. If it does not work, try selecting data for each of the groups and see what problems arise in each group.

In general, when you see "lavaan ERROR: ....", it means that you need to change the model, and the software is not the issue. lavaan R package is very powerful (https://lavaan.ugent.be/), but some models cannot be estimated nonetheless.
Pauline88
Posts: 5
Joined: Fri Apr 29, 2022 3:50 pm

Re: Another problem with SEMLj

Post by Pauline88 »

Hello!

Thank you very much for all these explanations! I am new to SEM and your precious advice will help me a lot!

I'm sorry to have taken your time!

Have a good day !
Paulina
Post Reply