def resid_dev(self, endog, mu, scale=1.):
        r"""
        Binomial deviance residuals

        Parameters
        -----------
        endog : array-like
            Endogenous response variable
        mu : array-like
            Fitted mean response variable
        scale : float, optional
            An optional argument to divide the residuals by scale. The default
            is 1.

        Returns
        -------
        resid_dev : array
            Deviance residuals as defined below

        Notes
        -----
        If the endogenous variable is binary:

        .. math::

           resid\_dev_i = sign(Y_i - \mu_i) * \sqrt{-2 *
                          \log(I_{1,i} * \mu_i + I_{0,i} * (1 - \mu_i))}

        where :math:`I_{1,i}` is an indicator function that evalueates to 1 if
        :math:`Y_i = 1`. and :math:`I_{0,i}` is an indicator function that
        evaluates to 1 if :math:`Y_i = 0`.

        If the endogenous variable is binomial:

        .. math::

           resid\_dev_i = sign(Y_i - \mu_i) \sqrt{2 * n_i *
                          (Y_i * \log(Y_i / \mu_i) + (1 - Y_i) *
                          \log(1 - Y_i)/(1 - \mu_i))}

        where :math:`Y_i` and :math:`n` are as defined in Binomial.initialize.
        """

        mu = self.link._clean(mu)
        if np.shape(self.n) == () and self.n == 1:
            one = np.equal(endog, 1)
            return np.sign(endog-mu)*np.sqrt(-2 *
                                             np.log(one * mu + (1 - one) *
                                                    (1 - mu)))/scale
        else:
            return (np.sign(endog - mu) *
                    np.sqrt(2 * self.n *
                            (endog * np.log(mu/endog + 1e-200) +
                             (1 - endog) * np.log((1 - endog)/(1 - mu) +
                                                  1e-200)))/scale)
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/genmod/families/family.py/Binomial.resid_dev/swapped operands of `/`