class_docstr: Dimension reduction for covariance matrices (CORE).
  
  Parameters
  ----------
  endog : array_like
      The dependent variable, treated as group labels
  exog : array_like
      The independent variables.
  dim : int
      The dimension of the subspace onto which the covariance
      matrices are projected.
  
  Returns
  -------
  A model instance.  Call `fit` on the model instance to obtain
  a results instance, which contains the fitted model parameters.
  
  Notes
  -----
  This is a likelihood-based dimension reduction procedure based
  on Wishart models for sample covariance matrices.  The goal
  is to find a projection matrix P so that C_i | P'C_iP and
  C_j | P'C_jP are equal in distribution for all i, j, where
  the C_i are the within-group covariance matrices.
  
  The model and methodology are as described in Cook and Forzani.
  The optimization method follows Edelman et. al.
  
  References
  ----------
  DR Cook, L Forzani (2008).  Covariance reducing models: an alternative
  to spectral modeling of covariance matrices.  Biometrika 95:4.
  
  A Edelman, TA Arias, ST Smith (1998).  The geometry of algorithms with
  orthogonality constraints. SIAM J Matrix Anal Appl.
  http://math.mit.edu/~edelman/publications/geometry_of_algorithms.pdf
class_docstr_tok: ["Dimension","reduction","for","covariance","matrices","(","CORE",")",".","Parameters","--","--","--","--","--","endog",":","array_like","The","dependent","variable",",","treated","as","group","labels","exog",":","array_like","The","independent","variables",".","dim",":","int","The","dimension","of","the","subspace","onto","which","the","covariance","matrices","are","projected",".","Returns","--","--","--","-","A","model","instance",".","Call","`","fit","`","on","the","model","instance","to","obtain","a","results","instance",",","which","contains","the","fitted","model","parameters",".","Notes","--","--","-","This","is","a","likelihood-based","dimension","reduction","procedure","based","on","Wishart","models","for","sample","covariance","matrices",".","The","goal","is","to","find","a","projection","matrix","P","so","that","C_i","|","P'C_iP","and","C_j","|","P'C_jP","are","equal","in","distribution","for","all","i",",","j",",","where","the","C_i","are","the","within-group","covariance","matrices",".","The","model","and","methodology","are","as","described","in","Cook","and","Forzani",".","The","optimization","method","follows","Edelman","et",".","al",".","References","--","--","--","--","--","DR","Cook",",","L","Forzani","(","2008",")",".","Covariance","reducing","models",":","an","alternative","to","spectral","modeling","of","covariance","matrices",".","Biometrika","95:4",".","A","Edelman",",","TA","Arias",",","ST","Smith","(","1998",")",".","The","geometry","of","algorithms","with","orthogonality","constraints",".","SIAM","J","Matrix","Anal","Appl",".","http",":","\/\/math.mit.edu\/~edelman\/publications\/geometry_of_algorithms.pdf"]
docstr: Fit the covariance reduction model.
  
  Parameters
  ----------
  start_params : array_like
      Starting value for the projection matrix. May be
      rectangular, or flattened.
  maxiter : int
      The maximum number of gradient steps to take.
  gtol : float
      Convergence criterion for the gradient norm.
  
  Returns
  -------
  A results instance that can be used to access the
  fitted parameters.
docstr_tok: ["Fit","the","covariance","reduction","model",".","Parameters","--","--","--","--","--","start_params",":","array_like","Starting","value","for","the","projection","matrix",".","May","be","rectangular",",","or","flattened",".","maxiter",":","int","The","maximum","number","of","gradient","steps","to","take",".","gtol",":","float","Convergence","criterion","for","the","gradient","norm",".","Returns","--","--","--","-","A","results","instance","that","can","be","used","to","access","the","fitted","parameters","."]
code: def fit(self, start_params=None, maxiter=200, gtol=1e-4):
      """
      Fit the covariance reduction model.
  
      Parameters
      ----------
      start_params : array_like
          Starting value for the projection matrix. May be
          rectangular, or flattened.
      maxiter : int
          The maximum number of gradient steps to take.
      gtol : float
          Convergence criterion for the gradient norm.
  
      Returns
      -------
      A results instance that can be used to access the
      fitted parameters.
      """
  
      p = self.covm.shape[0]
      d = self.dim
  
      # Starting value for params
      if start_params is None:
          params = np.zeros((p, d))
          params[0:d, 0:d] = np.eye(d)
          params = params
      else:
          params = start_params
  
      # _grass_opt is designed for minimization, we are doing maximization
      # here so everything needs to be flipped.
      params, llf, cnvrg = _grass_opt(
          params,
          lambda x: -self.loglike(x),
          lambda x: -self.score(x),
          maxiter,
          gtol,
      )
      llf *= -1
      if not cnvrg:
          g = self.score(params.ravel())
          gn = np.sqrt(np.sum(g * g))
          msg = "CovReduce optimization did not converge, |g|=%f" % gn
          warnings.warn(msg, ConvergenceWarning)
  
      results = DimReductionResults(self, params, eigs=None)
      results.llf = llf
      return DimReductionResultsWrapper(results)
  
imports: import warnings
  import numpy
  import pandas
  from statsmodels.base import model
  import statsmodels.base.wrapper
  from statsmodels.tools.sm_exceptions import ConvergenceWarning
label_desc: Use image node_id 4 for calling the CovarianceReduction obj's underlying member method code with example usage: obj.fit(start_params, maxiter, gtol) and returns: DimReductionResultsWrapper