class_docstr: TSM PARENT CLASS
  
  Contains general time series methods to be inherited by models.
  
  Parameters
  ----------
  model_type : str
      The type of model (e.g. 'ARIMA', 'GARCH')
class_docstr_tok: ["TSM","PARENT","CLASS","Contains","general","time","series","methods","to","be","inherited","by","models",".","Parameters","--","--","--","--","--","model_type",":","str","The","type","of","model","(","e.g",".","'ARIMA","'",",","'GARCH","'",")"]
docstr: Performs OLS
  
  Returns
  ----------
  None (stores latent variables)
docstr_tok: ["Performs","OLS","Returns","--","--","--","--","--","None","(","stores","latent","variables",")"]
code: def _ols_fit(self):
      """Performs OLS
  
      Returns
      ----------
      None (stores latent variables)
      """
  
      # TO DO - A lot of things are VAR specific here; might need to refactor in future, or just move to VAR script
  
      method = "OLS"
      self.use_ols_covariance = True
  
      res_z = self._create_B_direct().flatten()
      z = res_z.copy()
      cov = self.ols_covariance()
  
      # Inelegant - needs refactoring
      for i in range(self.ylen):
          for k in range(self.ylen):
              if i == k or i > k:
                  z = np.append(
                      z,
                      self.latent_variables.z_list[-1].prior.itransform(
                          cov[i, k]
                      ),
                  )
  
      ihessian = self.estimator_cov("OLS")
      res_ses = np.power(np.abs(np.diag(ihessian)), 0.5)
      ses = np.append(res_ses, np.ones([z.shape[0] - res_z.shape[0]]))
      self.latent_variables.set_z_values(z, method, ses, None)
  
      self.latent_variables.estimation_method = "OLS"
  
      (
          theta,
          Y,
          scores,
          states,
          states_var,
          X_names,
      ) = self._categorize_model_output(z)
  
      # Change this in future
      try:
          latent_variables_store = self.latent_variables.copy()
      except:
          latent_variables_store = self.latent_variables
  
      return MLEResults(
          data_name=self.data_name,
          X_names=X_names,
          model_name=self.model_name,
          model_type=self.model_type,
          latent_variables=latent_variables_store,
          results=None,
          data=Y,
          index=self.index,
          multivariate_model=self.multivariate_model,
          objective_object=self.neg_loglik,
          method=method,
          ihessian=ihessian,
          signal=theta,
          scores=scores,
          z_hide=self._z_hide,
          max_lag=self.max_lag,
          states=states,
          states_var=states_var,
      )
  
imports: from math import exp, sqrt, log, tanh
  import copy
  import sys
  import warnings
  import numpy
  from scipy import optimize
  import numdifftools
  import pandas
  from .covariances import acf
  from .families import Normal
  from .inference import BBVI, BBVIM, MetropolisHastings, norm_post_sim
  from .output import TablePrinter
  from .tests import find_p_value
  from .latent_variables import LatentVariable, LatentVariables
  from .results import BBVIResults, MLEResults, LaplaceResults, MCMCResults
label_desc: Use image node_id 6 for calling the TSM obj's underlying member method code with example usage: obj._ols_fit() and returns: MLEResults