title: Factor analysis in python (similar to factal() from R)
body: <p>I have been struggling to perform factor analysis using sklearn from python.</p>
  
  <p>In R after running the following code:</p>
  
  <pre><code>x.f &lt;- factanal(data_final, factors = 2, rotation="varimax",  scores="regression", lower = 0.01)
  </code></pre>
  
  <p>I get the following result :</p>
  
  <pre><code>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 
  </code></pre>
  
  <p>I can easily interpret this code, and understand the output and process behind it. </p>
  
  <p>However, when I run the following code in python, I am not sure what is happening and if it is correct. </p>
  
  <pre><code>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]])
  </code></pre>
  
  <p>Is there an easier way to perform factor analysis in python? If not, how can I obtain the factor components from my python code?</p>
  
  <p>If its of any use, the dataset I am using is a set of log returns in futures contracts of 10 assets.</p>
  
  <p>thanks in advance</p>