class_docstr: Factor analysis
  
  Parameters
  ----------
  endog : array_like
      Variables in columns, observations in rows.  May be `None` if
      `corr` is not `None`.
  n_factor : int
      The number of factors to extract
  corr : array_like
      Directly specify the correlation matrix instead of estimating
      it from `endog`.  If provided, `endog` is not used for the
      factor analysis, it may be used in post-estimation.
  method : str
      The method to extract factors, currently must be either 'pa'
      for principal axis factor analysis or 'ml' for maximum
      likelihood estimation.
  smc : True or False
      Whether or not to apply squared multiple correlations (method='pa')
  endog_names : str
      Names of endogenous variables.  If specified, it will be used
      instead of the column names in endog
  nobs : int
      The number of observations, not used if endog is present. Needs to
      be provided for inference if endog is None.
  missing : 'none', 'drop', or 'raise'
      Missing value handling for endog, default is row-wise deletion 'drop'
      If 'none', no nan checking is done. If 'drop', any observations with
      nans are dropped. If 'raise', an error is raised.
  
  
  Notes
  -----
  **Experimental**
  
  Supported rotations: 'varimax', 'quartimax', 'biquartimax',
  'equamax', 'oblimin', 'parsimax', 'parsimony', 'biquartimin',
  'promax'
  
  If method='ml', the factors are rotated to satisfy condition IC3
  of Bai and Li (2012).  This means that the scores have covariance
  I, so the model for the covariance matrix is L * L' + diag(U),
  where L are the loadings and U are the uniquenesses.  In addition,
  L' * diag(U)^{-1} L must be diagonal.
  
  References
  ----------
  .. [*] Hofacker, C. (2004). Exploratory Factor Analysis, Mathematical
     Marketing. http://www.openaccesstexts.org/pdf/Quant_Chapter_11_efa.pdf
  .. [*] J Bai, K Li (2012).  Statistical analysis of factor models of high
     dimension.  Annals of Statistics. https://arxiv.org/pdf/1205.6617.pdf
class_docstr_tok: ["Factor","analysis","Parameters","--","--","--","--","--","endog",":","array_like","Variables","in","columns",",","observations","in","rows",".","May","be","`","None","`","if","`","corr","`","is","not","`","None","`",".","n_factor",":","int","The","number","of","factors","to","extract","corr",":","array_like","Directly","specify","the","correlation","matrix","instead","of","estimating","it","from","`","endog","`",".","If","provided",",","`","endog","`","is","not","used","for","the","factor","analysis",",","it","may","be","used","in","post-estimation",".","method",":","str","The","method","to","extract","factors",",","currently","must","be","either","'pa'","for","principal","axis","factor","analysis","or","'ml","'","for","maximum","likelihood","estimation",".","smc",":","True","or","False","Whether","or","not","to","apply","squared","multiple","correlations","(","method='pa","'",")","endog_names",":","str","Names","of","endogenous","variables",".","If","specified",",","it","will","be","used","instead","of","the","column","names","in","endog","nobs",":","int","The","number","of","observations",",","not","used","if","endog","is","present",".","Needs","to","be","provided","for","inference","if","endog","is","None",".","missing",":","'none","'",",","'drop","'",",","or","'raise'","Missing","value","handling","for","endog",",","default","is","row-wise","deletion","'drop'","If","'none","'",",","no","nan","checking","is","done",".","If","'drop","'",",","any","observations","with","nans","are","dropped",".","If","'raise","'",",","an","error","is","raised",".","Notes","--","--","-","*","*","Experimental","*","*","Supported","rotations",":","'varimax","'",",","'quartimax","'",",","'biquartimax","'",",","'equamax","'",",","'oblimin","'",",","'parsimax","'",",","'parsimony","'",",","'biquartimin","'",",","'promax'","If","method='ml","'",",","the","factors","are","rotated","to","satisfy","condition","IC3","of","Bai","and","Li","(","2012",")",".","This","means","that","the","scores","have","covariance","I",",","so","the","model","for","the","covariance","matrix","is","L","*","L","'","+","diag","(","U",")",",","where","L","are","the","loadings","and","U","are","the","uniquenesses",".","In","addition",",","L","'","*","diag","(","U",")","^","{","-1","}","L","must","be","diagonal",".","References","--","--","--","--","--","..","[","*","]","Hofacker",",","C.","(","2004",")",".","Exploratory","Factor","Analysis",",","Mathematical","Marketing",".","http",":","\/\/www.openaccesstexts.org\/pdf\/Quant_Chapter_11_efa.pdf","..","[","*","]","J","Bai",",","K","Li","(","2012",")",".","Statistical","analysis","of","factor","models","of","high","dimension",".","Annals","of","Statistics",".","https",":","\/\/arxiv.org\/pdf\/1205.6617.pdf"]
docstr: Evaluate the score function (first derivative of loglike).
  
  Parameters
  ----------
  par : ndarray or tuple of 2 ndarray's
      The model parameters, either a packed representation of
      the model parameters or a 2-tuple containing a `k_endog x
      n_factor` matrix of factor loadings and a `k_endog` vector
      of uniquenesses.
  
  Returns
  -------
  ndarray
      The score function evaluated at par.
docstr_tok: ["Evaluate","the","score","function","(","first","derivative","of","loglike",")",".","Parameters","--","--","--","--","--","par",":","ndarray","or","tuple","of","2","ndarray's","The","model","parameters",",","either","a","packed","representation","of","the","model","parameters","or","a","2-tuple","containing","a","`","k_endog","x","n_factor","`","matrix","of","factor","loadings","and","a","`","k_endog","`","vector","of","uniquenesses",".","Returns","--","--","--","-","ndarray","The","score","function","evaluated","at","par","."]
code: def score(self, par):
      """
      Evaluate the score function (first derivative of loglike).
  
      Parameters
      ----------
      par : ndarray or tuple of 2 ndarray's
          The model parameters, either a packed representation of
          the model parameters or a 2-tuple containing a `k_endog x
          n_factor` matrix of factor loadings and a `k_endog` vector
          of uniquenesses.
  
      Returns
      -------
      ndarray
          The score function evaluated at par.
      """
  
      if type(par) is np.ndarray:
          uniq, load = self._unpack(par)
      else:
          load, uniq = par[0], par[1]
  
      # Center term of SMW
      loadu = load / uniq[:, None]
      c = np.dot(load.T, loadu)
      c.flat[:: c.shape[0] + 1] += 1
      d = np.linalg.solve(c, load.T)
  
      # Precompute these terms
      lud = np.dot(loadu, d)
      cu = (self.corr / uniq) / uniq[:, None]
      r = np.dot(cu, load)
      lul = np.dot(lud.T, load)
      luz = np.dot(cu, lul)
  
      # First term
      du = (
          2
          * np.sqrt(uniq)
          * (1 / uniq - (d * load.T).sum(0) / uniq**2)
      )
      dl = 2 * (loadu - np.dot(lud, loadu))
  
      # Second term
      h = np.dot(lud, cu)
      f = np.dot(h, lud.T)
      du -= (
          2
          * np.sqrt(uniq)
          * (np.diag(cu) - 2 * np.diag(h) + np.diag(f))
      )
      dl -= 2 * r
      dl += 2 * np.dot(lud, r)
      dl += 2 * luz
      dl -= 2 * np.dot(lud, luz)
  
      # Cannot use _pack because we are working with the square root
      # uniquenesses directly.
      return -np.concatenate((du, dl.T.flat)) / (2 * self.k_endog)
  
imports: import warnings
  import numpy
  from numpy.linalg import eigh, inv, norm, matrix_rank
  import pandas
  from scipy.optimize import minimize
  from statsmodels.tools.decorators import cache_readonly
  from statsmodels.base.model import Model
  from statsmodels.iolib import summary2
  from statsmodels.graphics.utils import _import_mpl
  from .factor_rotation import rotate_factors, promax
label_desc: Use image node_id 9 for calling the Factor obj's underlying member method code with example usage: obj.score(par) and returns: unknown