jasp-stats / jasp-issues

This repository is solely meant for reporting of bugs, feature requests and other issues in JASP.
58 stars 29 forks source link

Factor Analysis (EFA/CFA/SEM module): Requested feature #1319

Closed hynekcigler closed 6 months ago

hynekcigler commented 3 years ago

Hi, I use JASP in my bachelor and master classes of psychometrics for EFA and CFA lectures. Students usually have previous experiences with SPSS, but as I prefer free software and as CFA is not implemented in SPSS, JASP is a clear choice (I tried out also JAMOVI and the problems are very similar to which I describe bellow).

First of all, CFA module in JASP is great, I like it. However, I am missing some features, which are more or less crucial. When I teach, I usually conclude "JASP is fine for learning CFA, but for a proper analysis, you need R". This is a pity.

I try to make an overview per analysis, dividing my requests to major and minor. Clear errors are bolded.

Finally, I see I have wrote probably too many requests :) If you liked to, I would be glad to provide more detailed solutions for the requested features bellow.

EFA

Major requests

  1. BUG: Output/Factor correlations: This is not factor correlation (so called psi matrix), but correlation of estimated factor scores. You can check it using orthogonal extraction method (or even no rotation), which leads to non-zero off-diagonal elements.
  2. Residual matrix: Residuals are very important for exploring missfit of EFA/CFA; unfortunately, they are not available. I suggest to add to Output options new table (residuals).
  3. Is it possible to include other fit indices? Especially SRMR and TLI/CFI.

    Minor requests

  4. Scree plot shows eigenvalues of reduced matrix (so called eigenvalues after an extraction). Unfortunately, researchers are more familiar with raw (initial) eigenvalues. The so called Kaiser rule ("extract the number of factor equal to eigenvalues higher than 1) also concerns the initial eigenvalues. I would recommend to switch to these initial eigenvalues or to provide an option. See e.g. psych::fa.parallel function (option fa=c("fa", "pca")).
  5. Is it possible to "save" estimated factor scores? This would be useful if a researcher want to use them for following analyses.
  6. Ordinal variables cannot be passed to EFA. This is correct, as EFA model assumes continuous interval variables. Unfortunately, I JASP reads CSV file, it usually labels item responses as ordinal, and they have to be manually switched. Is it possible to enable ordinal variables in EFA? The analysis would remain the same.
  7. It would be very nice to be able to analyze ordinal variables using polychoric/tetrachoric correlation matrix instead of Pearson matrix. This would be implemented in "Base analysis on...", where is an option correlation/covariance. Adding polychoric correlation matrix would be very nice.

CFA (and partially SEM modul)

Major requests

  1. BUG: Using grouping variable sometimes lead to error: "lavaan ERROR: wrong number of arguments in modifier () of element Factor1~1". Probably an error in parameter names?
  2. I am glad to see emulation options, SE estimation methods etc. Unfortunately, there is missing any robust estimator like MLR/MLM, WLSMV etc. Is it possible to include them?
  3. It is not clear how it is dealt with missing data. Pairwise, listwise, FIML? It would be very nice to include an option.

Minor requests

  1. Ordinal variables as output, see Minor 3 in EFA.
  2. Is it possible to include "ordinal CFA" using polychoric correlation matrix and WLSMV estimator? In lavaan, this is equal to "ordered=TRUE". It would be also possible to treat variables according their level (ordinal/interval) as specified in dataset.
  3. It would be very useful to include the RMSEA for baseline model (see, e.g., semTools:nullRMSEA function).
  4. Is it possible to add reliability estimation? This would allow to estimate reliability in more complicated models. You can use function semTools::reliability over an estimated model (probably with returnTotal=TRUE).

SEM module only

  1. BUG: There is error in "Chi-square statistics" or "Model test baseline model" as they have the same values.
vandenman commented 3 years ago

@JMBKoch could you take a look at the SEM-related issue?

@hynekcigler Thanks for the very detailed request! Most of your requests look very reasonable.

Some questions/ remarks:

BUG: Using grouping variable sometimes lead to error: "lavaan ERROR: wrong number of arguments in modifier () of element Factor1~1". Probably an error in parameter names?

Can you share a JASP file that replicates this bug? The error message by itself is insufficient to replicate the problem.

Is it possible to "save" estimated factor scores? This would be useful if a researcher want to use them for following analyses.

There is an open issue for this, but this is, unfortunately, more complicated than it sounds.

hynekcigler commented 3 years ago

Can you share a JASP file

@vandenman EDIT: I found the problem. It occurs if a mean-structure is requested (which is, obviously, necessary in measurement-invariance testing). See JASP file here: https://www.dropbox.com/s/pwpktzu2s514fsx/example.jasp?dl=0.

There is an open issue for this, but this is, unfortunately, more complicated than it sounds.

I am aware of it and it is not so necessary. However, an easy way to implement it (at least partially) is to provide item weight matrix, which could be used manually. With such a matrix, research would compute weighted mean or sum to get factor scores. Obviously, this would not work for ordinal EFA/CFA, but it would be sufficient for traditional continuous FA.

In addition, if such a table was provided, it would be useful to estimate factor score determination coefficient as a reliability estimate for these factor scores.

JMBKoch commented 3 years ago

@vandenman will do!

AlejandroPeru commented 3 years ago

I support the request, it would also include the use of polychoric or tetrachoric matrices, which would allow working ordinal items (it can even be a separate module), Both for AFC and EFA, I commented on the work that a Spanish already did in a visual Basic application, the Factor, ideal for AFE. https://psico.fcep.urv.cat/utilitats/factor/Download.html There you will find the base articles and the program https://psico.fcep.urv.cat/utilitats/factor/soft/factor.11.04.02.WIN64.zip As the friend says, it is sad to always say better R than Jasp, since by increasing only those processes the program would be complete to carry out a basic psychometric investigation, and what usually happens is that we report inadequate results for not having an accessible tool at hand . I will continue insisting on it. Thanks.

JMBKoch commented 2 years ago

@juliuspf see 1. under "Minor Requests".

juliuspfadt commented 2 years ago

Hi @hynekcigler. This is weird, I received an email about this issue, but I cannot find your last comment? Regarding the things you addressed:

hynekcigler commented 2 years ago

Hi @juliuspf. I really apologize. Long story short: I came to my class today morning, opened JASP on the university PC, and realized the bug had been fixed. I immediately deleted my previous comment, but I didn't be aware that you were already e-mailed. I take a lesson that I shouldn't prepare my classes after midnight and some glasses of wine :)

Anyway, thank you, the bug is fixed; I can confirm it.

juliuspfadt commented 2 years ago

No need to apologize. It is good that you followed up, since there are still features missing that are worthwhile to add to the module.

hynekcigler commented 2 years ago

Thanks :) If you need any consultation or review (as I see there are some open questions in the other requests), don't hesitate to mention me, I would be glad to help.

juliuspfadt commented 1 year ago

I think most of the issue from the EFA list are fixed. @LSLindeloo @Kucharssim, what do you think about the CFA/SEM things. They seem reasonable, but maybe they should be moved to separate issues?

LSLindeloo commented 1 year ago

@juliuspf Yes, they sure seem reasonable. I can work on these issues tomorrow! @Kucharssim, do you prefer separate issues?

hynekcigler commented 1 year ago

Dear all, if you appreciate some beta-testing or any other help, I would be pleased :)

tomtomme commented 7 months ago

@hynekcigler Can you confirm that all your issues are now fixed? If not, please list the missing ones.