class_docstr: A simple ordinary least squares model.
  
  Parameters
  ----------
  design : array-like
      This is your design matrix.  Data are assumed to be column ordered
      with observations in rows.
  
  Methods
  -------
  model.__init___(design)
  model.logL(b=self.beta, Y)
  
  Attributes
  ----------
  design : ndarray
      This is the design, or X, matrix.
  
  whitened_design : ndarray
      This is the whitened design matrix.
      `design` == `whitened_design` by default for the OLSModel,
      though models that inherit from the OLSModel will whiten the design.
  
  calc_beta : ndarray
      This is the Moore-Penrose pseudoinverse of the whitened design matrix.
  
  normalized_cov_beta : ndarray
      ``np.dot(calc_beta, calc_beta.T)``
  
  df_residuals : scalar
      Degrees of freedom of the residuals.  Number of observations less the
      rank of the design.
  
  df_model : scalar
      Degrees of freedome of the model.  The rank of the design.
docstr: Fit model to data `Y`.
  
  Full fit of the model including estimate of covariance matrix,
  (whitened) residuals and scale.
  
  Parameters
  ----------
  Y : array-like
      The dependent variable for the Least Squares problem.
  
  Returns
  -------
  fit : RegressionResults
docstr_tok: ["Fit","model","to","data","`","Y","`",".","Full","fit","of","the","model","including","estimate","of","covariance","matrix",",","(","whitened",")","residuals","and","scale",".","Parameters","--","--","--","--","--","Y",":","array-like","The","dependent","variable","for","the","Least","Squares","problem",".","Returns","--","--","--","-","fit",":","RegressionResults"]
code: def fit(self, Y):
      """Fit model to data `Y`.
  
      Full fit of the model including estimate of covariance matrix,
      (whitened) residuals and scale.
  
      Parameters
      ----------
      Y : array-like
          The dependent variable for the Least Squares problem.
  
      Returns
      -------
      fit : RegressionResults
  
      """
      # Other estimates of the covariance matrix for a heteroscedastic
      # regression model can be implemented in WLSmodel. (Weighted least
      # squares models assume covariance is diagonal, i.e. heteroscedastic).
      wY = self.whiten(Y)
      beta = np.dot(self.calc_beta, wY)
      wresid = wY - np.dot(self.whitened_design, beta)
      dispersion = np.sum(wresid**2, 0) / (
          self.whitened_design.shape[0] - self.whitened_design.shape[1]
      )
      lfit = RegressionResults(
          beta,
          Y,
          self,
          wY,
          wresid,
          dispersion=dispersion,
          cov=self.normalized_cov_beta,
      )
      return lfit
  
imports: import numpy
  import scipy.linalg
  from nibabel.onetime import auto_attr
  from numpy.linalg import matrix_rank
  from nilearn.glm._utils import positive_reciprocal
  from nilearn.glm.model import LikelihoodModelResults
label_desc: Use image node_id 5 for calling the OLSModel obj's underlying member method code with example usage: obj.fit(Y) and returns: lfit