1
votes

I have a dataset with 29 items to be run Exploratory Factor Analysis. I have implemented this dataset with the same factors in both Python and Stata, but I have two different results. Actually they are different since I identified the eigenvalues: in Python it is 4 but in Stata only 2.

Why are there such differences and which result should I take? Here are my codes Python

df = df[df.g1 == 3]
fa = FactorAnalyzer()
fa.set_params(n_factors=6) # so factor
fa.fit(df)
fa.loadings_
fa_loading_df = pd.DataFrame(fa.loadings_, columns=['Factor 1', 'Factor 2', 'Factor 3', 'Factor 4', 'Factor 5', 'Factor 6'])

Stata

factor k2x1-k2x29 if g1==3, factor(6)
rotate, varimax norm blanks(.40)

Results

1
Factor analysis isn't as standardised as you might imagine. For further details, I think you need to post a reproducible example with a dataset and code in both programs.Nick Cox
I would put that in the question. As already edited, please note that the spelling is Stata, not STATA. More importantly, you want someone who uses both Python and Stata to answer -- that's not me -- and without showing any data or results you may not get much help.Nick Cox
@NickCox thanks, I have edited the question. I am a newbie. Thanks for your supportsagittarius2112

1 Answers

0
votes

You need to understand what type of exploratory factor analysis (EFA) each command performs, and what type YOU want it to perform. There are multiple types of EFA, such as principal factor, principal component factor, ML etc.

My guess Python and Stata have different default methods, hence you get different results. In your commands, you don't specify the method to be used, hence the default methods is used.

In Stata, the default is principal factor, while in Python, my guess is the default is minres, according to this web: https://factor-analyzer.readthedocs.io/en/latest/factor_analyzer.html