[Python] Calculating goodness of fit and rmsea from factor_analyser in python

Discussão em 'Python' iniciado por Stack, Abril 29, 2025.

  1. Stack

    Stack Membro Participativo

    I am performing Confirmatory factor analysis in python using the factor_analyzer module.

    I have searched hi and low for a way to generate the model diagnostics such as the Root Mean Square Error of Approximation, the chi square, the CFI and Tucker-Lewis index. I'm not particularly mathematically inclined and relatively new to python but I have been able to muddle through for the most part.

    I understand that the factor_analyzer module produces a lot of different objects that allow would, in-theory, allow me to carry out additional calculations and I have found this document which provides me with most of the formula I need. However, I do not know what to take (or calculate) to get the model diagnostics I need.

    The CFA code is


    model_dict = {"F1": factor_1,
    "F2": factor_2}# I have made these lists previously

    model_spec = ModelSpecificationParser.parse_model_specification_from_dict(df[influence_scale],
    model_dict)
    cfa = ConfirmatoryFactorAnalyzer(model_spec, disp=False)

    cfa.fit(df[influence_scale].values)

    cfa_loadings = pd.DataFrame(cfa.loadings_)


    I have gotten no errors and the code works fine giving me clean loadings as I would have expected on each factor, however I'm really stuck on getting the additional stats I need.

    If anyone can help me out I'd really really appreciate it.

    Continue reading...

Compartilhe esta Página