0
私はpythonのsklearnを使って因子分析を実行するのに苦労しています。 Rで Pythonでの因子分析(Rからfactal()に似ています)
次のコードを実行した後:Call:
factanal(x = data_final, factors = 2, scores = "regression", rotation = "varimax", lower = 0.01)
Uniquenesses:
WTI GOLD CAC40 DAX EUR_DOLL YEN_DOLL SP500 NIKKEI GILT TEN_TRES
0.740 0.971 0.115 0.056 0.789 0.775 0.283 0.022 0.849 0.754
Loadings:
Factor1 Factor2
WTI 0.400 0.317
GOLD 0.169
CAC40 0.857 0.387
DAX 0.903 0.359
EUR_DOLL 0.371 0.271
YEN_DOLL -0.472
SP500 0.511 0.675
NIKKEI 0.337 0.930
GILT -0.334 -0.197
TEN_TRES -0.343 -0.358
Factor1 Factor2
SS loadings 2.482 2.163
Proportion Var 0.248 0.216
Cumulative Var 0.248 0.465
Test of the hypothesis that 2 factors are sufficient.
The chi square statistic is 686.84 on 26 degrees of freedom.
The p-value is 4.16e-128
は、私は簡単にこのコードを解釈し、その背後に出力し、プロセスを理解することができます
x.f <- factanal(data_final, factors = 2, rotation="varimax", scores="regression", lower = 0.01)
私は、次の結果を得ます。
しかし、次のコードをPythonで実行すると、何が起こっているのか、正しいのか分かりません。
from sklearn import decomposition
from sklearn.decomposition import FactorAnalysis
factor = decomposition.FactorAnalysis(n_components=2)
factor.fit(data_final.iloc[:, 1::])
factor.components_
array([[-0.01175024, -0.00157749, -0.01547956, -0.01353783, -0.00322834,
0.00225613, -0.01085127, -0.01219159, 0.00247041, 0.00210084],
[ 0.00021618, -0.00135881, -0.00419973, -0.00435391, -0.00012713,
-0.00225637, 0.00275685, 0.00686218, 0.00034337, -0.00035002]])
pythonで因子分析を実行する簡単な方法はありますか?そうでない場合は、私のpythonコードからfactorコンポーネントを取得するにはどうすればよいですか?
私が使用しているデータセットは、10資産の先物契約のログ返品のセットです。
ありがとうございました