Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: n_factors_f is not being used in FactorAnalyzer model fitting. #6

Open
pmdscully opened this issue Oct 16, 2023 · 4 comments
Open
Assignees

Comments

@pmdscully
Copy link
Contributor

pmdscully commented Oct 16, 2023

Bug:

n_factors_f is not forwarded to the FactorAnalyzer modelling process for group factors; and therefore the code always fits for 3 factors only. - Here's an example of code and outputs in colab.

Fix: add 1 line (an extra argument) into the call for group factors, around lines 183-185, as below:

        self.fa_f = FactorAnalyzer(rotation=self.rotation_fa_f,
                                   method=self.method_fa_f,
                                   n_factors=self.n_factors_f, # <--- This line.
                                   is_corr_matrix=True)
        self.fa_f.fit(self.correlations_matrix)
        self.fa_g = FactorAnalyzer(rotation=None,
                                   is_corr_matrix=True,
                                   method=self.method_fa_g,
                                   n_factors=1)

I have recompiled the .pyc and tested this. It should be a straightforward fix.

P.s. - Thanks for your work on this project, I've included your citation in our upcoming report. All the best.

pmdscully added a commit to pmdscully/reliabiliPy that referenced this issue Oct 17, 2023
Fix for rafaelvalero#6 , adds argument to FactorAnalyzer call for group factors.
```
n_factors=self.n_factors_f,
```
@rafaelvalero
Copy link
Owner

Thanks let me try locally and update version on pip

rafaelvalero added a commit that referenced this issue Oct 28, 2023
Fix for issue #6 `n_factors_f` not used.
@rafaelvalero
Copy link
Owner

Thanks, new version ready: https://pypi.org/project/reliabiliPy/0.0.36/

@rafaelvalero
Copy link
Owner

Done

@rafaelvalero rafaelvalero self-assigned this Oct 28, 2023
@pmdscully
Copy link
Contributor Author

Great stuff.
Btw, I noticed that the factor model fitness metrics (indices - i.e. CFI, TLI, RMSEA, GFI, etc.) are not calculated by the FA library (their issue 99 raised this already, but no implementation yet).

As with the Psyche R library implementation for Omega, I think it is important to show underlying model fitness before presenting an Omega result; so I will look at adding those fit indices (similarly to semopy) into the FA library. Then, from reliabiliPy, those functions can be called on the underlying fa models.

It all seems to depend on how easily a 'null-model' (flat) can be implemented and evaluated by FA. Let's see..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants