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 a Laplace approximation to the posterior
  
  Parameters
  ----------
  obj_type : method
      Whether a likelihood or a posterior
  
  Returns
  ----------
  None (plots posterior)
docstr_tok: ["Performs","a","Laplace","approximation","to","the","posterior","Parameters","--","--","--","--","--","obj_type",":","method","Whether","a","likelihood","or","a","posterior","Returns","--","--","--","--","--","None","(","plots","posterior",")"]
code: def _laplace_fit(self, obj_type):
      """Performs a Laplace approximation to the posterior
  
      Parameters
      ----------
      obj_type : method
          Whether a likelihood or a posterior
  
      Returns
      ----------
      None (plots posterior)
      """
  
      # Get Mode and Inverse Hessian information
      y = self.fit(method="PML", printer=False)
  
      if y.ihessian is None:
          raise Exception(
              "No Hessian information - Laplace approximation cannot be performed"
          )
      else:
          self.latent_variables.estimation_method = "Laplace"
  
          (
              theta,
              Y,
              scores,
              states,
              states_var,
              X_names,
          ) = self._categorize_model_output(
              self.latent_variables.get_z_values()
          )
  
          # Change this in future
          try:
              latent_variables_store = self.latent_variables.copy()
          except:
              latent_variables_store = self.latent_variables
  
          return LaplaceResults(
              data_name=self.data_name,
              X_names=X_names,
              model_name=self.model_name,
              model_type=self.model_type,
              latent_variables=latent_variables_store,
              data=Y,
              index=self.index,
              multivariate_model=self.multivariate_model,
              objective_object=obj_type,
              method="Laplace",
              ihessian=y.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 4 for calling the TSM obj's underlying member method code with example usage: obj._laplace_fit(obj_type) and returns: LaplaceResults