是否有用于在python中执行确认性因子分析的软件包?我发现一些可以在python中执行探索性因子分析的工具(scikitlearn,factor_analyzer等),但是我还没有找到一个可以执行CFA的软件包。
答案 0 :(得分:0)
您可以尝试使用软件包psy(https://pypi.org/project/psy/)。我找不到其文档,但是可以阅读中文注释。
示例:
import psy
# items is a pandas data frame containing item data
# Specify how the items are mapped to the factors
# In this case, all mapped to one factor
item_factor_mapping = np.array([[1]] * items.shape[1])
print(psy.cfa(items, item_factor_mapping))
答案 1 :(得分:0)
factor_analyzer也可以执行CFA:
import pandas as pd
from factor_analyzer import FactorAnalyzer
df= pd.read_csv("test.csv")
from factor_analyzer import (ConfirmatoryFactorAnalyzer, ModelSpecificationParser)
model_dict = {"F1": ["V1", "V2", "V3", "V4"], "F2": ["V5", "V6", "V7", "V8"]}
model_spec = ModelSpecificationParser.parse_model_specification_from_dict(df, model_dict)
cfa = ConfirmatoryFactorAnalyzer(model_spec, disp=False)
cfa.fit(df.values)
cfa.loadings_