def loglikeobs(self, params):
    '\n        Loglikelihood for observations of Generic Zero Inflated model.\n\n        Parameters\n        ----------\n        params : array_like\n            The parameters of the model.\n\n        Returns\n        -------\n        loglike : ndarray\n            The log likelihood for each observation of the model evaluated\n            at `params`. See Notes for definition.\n\n        Notes\n        -----\n        .. math:: \\ln L=\\ln(w_{i}+(1-w_{i})*P_{main\\_model})+\n            \\ln(1-w_{i})+L_{main\\_model}\n            where P - pdf of main model, L - loglike function of main model.\n\n        for observations :math:`i=1,...,n`\n        '
    params_infl = params[:self.k_inflate]
    params_main = params[self.k_inflate:]
    y = self.endog
    w = self.model_infl.predict(params_infl)
    w = np.clip(w, np.finfo(float).eps, (1 - np.finfo(float).eps))
    llf_main = self.model_main.loglikeobs(params_main)
    zero_idx = np.nonzero((y == 0))[0]
    nonzero_idx = np.nonzero(y)[0]
    llf = np.zeros_like(y, dtype=np.float64)
    llf[zero_idx] = np.log((w[zero_idx] + ((1 - w[zero_idx]) * np.exp(llf_main[zero_idx]))))
    llf[nonzero_idx] = (np.log((1 - w[nonzero_idx])) + llf_main[nonzero_idx])
    return llf
Loglikelihood for observations of Generic Zero Inflated model.

Parameters
----------
params : array_like
    The parameters of the model.

Returns
-------
loglike : ndarray
    The log likelihood for each observation of the model evaluated
    at `params`. See Notes for definition.

Notes
-----
.. math:: \ln L=\ln(w_{i}+(1-w_{i})*P_{main\_model})+
    \ln(1-w_{i})+L_{main\_model}
    where P - pdf of main model, L - loglike function of main model.

for observations :math:`i=1,...,n`
def loglikeobs(self, params):
    '\n        Loglikelihood for observations of Generic Zero Inflated model.\n\n        Parameters\n        ----------\n        params : array_like\n            The parameters of the model.\n\n        Returns\n        -------\n        loglike : ndarray\n            The log likelihood for each observation of the model evaluated\n            at `params`. See Notes for definition.\n\n        Notes\n        -----\n        .. math:: \\ln L=\\ln(w_{i}+(1-w_{i})*P_{main\\_model})+\n            \\ln(1-w_{i})+L_{main\\_model}\n            where P - pdf of main model, L - loglike function of main model.\n\n        for observations :math:`i=1,...,n`\n        '
    params_infl = params[:self.k_inflate]
    params_main = params[self.k_inflate:]
    y = self.endog
    w = self.model_infl.predict(params_infl)
    w = np.clip(w, np.finfo(float).eps, (1 - np.finfo(float).eps))
    llf_main = self.model_main.loglikeobs(params_main)
    zero_idx = np.nonzero((y == 0))[0]
    nonzero_idx = np.nonzero(y)[0]
    llf = np.zeros_like(y, dtype=np.float64)
    llf[zero_idx] = np.log((w[zero_idx] + ((1 - w[zero_idx]) * np.exp(llf_main[zero_idx]))))
    llf[nonzero_idx] = (np.log((1 - w[nonzero_idx])) + llf_main[nonzero_idx])
    return llf