code: def _ols_fit(self):
          
  
          # 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)
docs: Performs OLS
  
          Returns
          ----------
          None (stores latent variables)