I used factor_analyzer
Python package for CFA, but matrix of factor loadings that I getgot contains value smaller than -1. Is a bug in the package, or maybe I misunderstood the factor loading interpretation?
factor_analyzer docs: https://pypi.org/project/factor-analyzer/
My code:
def sem_analysis(data, group1, group2):
scaler = StandardScaler()
scaled_data = pd.DataFrame(scaler.fit_transform(data), columns=data.columns)
required_data = scaled_data[group1 + group2]
model_dict = {"F1": group1, "F2": group2}
model_spec = ModelSpecificationParser.parse_model_specification_from_dict(required_data, model_dict)
cfa = ConfirmatoryFactorAnalyzer(model_spec, disp=False)
cfa.fit(required_data.values)
return cfa.loadings_
My results:
[[ 0.81664434 0. ]
[ 0.76591388 0. ]
[-0.84197706 0. ]
[ 0. -0.27572329]
[ 0. -1.17491134]
[ 0. 0.39020765]]