def loglike(self, params, *args, **kwargs):
        # We need to handle positional arguments in two ways, in case this was
        # called by a Scipy optimization routine
        if len(args) > 0:
            argnames = ['transformed', 'complex_step']
            # the fit() method will pass a dictionary
            if isinstance(args[0], dict):
                flags = args[0]
            # otherwise, a user may have just used positional arguments...
            else:
                flags = dict(zip(argnames, args))
            transformed = flags.get('transformed', True)
            complex_step = flags.get('complex_step', True)

            for name, value in flags.items():
                if name in kwargs:
                    raise TypeError("loglike() got multiple values for keyword"
                                    " argument '%s'" % name)
        else:
            transformed = kwargs.pop('transformed', True)
            complex_step = kwargs.pop('complex_step', True)

        if not transformed:
            params = self.transform_params(params)

        self.update(params, transformed=True, complex_step=complex_step)

        if complex_step:
            kwargs['inversion_method'] = INVERT_UNIVARIATE | SOLVE_LU

        loglike = self.ssm.loglike(complex_step=complex_step, **kwargs)

        # Koopman, Shephard, and Doornik recommend maximizing the average
        # likelihood to avoid scale issues, but the averaging is done
        # automatically in the base model `fit` method
        return loglike
Loglikelihood evaluation
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/tsa/statespace/mlemodel.py/MLEModel.loglike