def resid_anscombe(self, endog, mu):
        """
        The Anscombe residuals for the Tweedie family

        Parameters
        ----------
        endog : array-like
            Endogenous response variable
        mu : array-like
            Fitted mean response variable

        Returns
        -------
        resid_anscombe : array
            The Anscombe residuals as defined below.

        Notes
        -----
        When :math:`p = 3`, then

        .. math::

            resid\_anscombe_i = (\log(endog) - \log(\mu)) / \sqrt{mu}

        Otherwise,

        .. math::

            c = (3 - p) / 3

        .. math::

            resid\_anscombe_i = (1 / c) * (endog ^ c - \mu ^ c) / \mu ^{p / 6}
        """
        if self.var_power == 3:
            return (np.log(endog) - np.log(mu)) / np.sqrt(mu)
        else:
            c = (3. - self.var_power) / 3.
            return ((1. / c) * (endog ** c - mu ** c) /
                    mu ** (self.var_power / 6.))
dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/genmod/families/family.py/Tweedie.resid_anscombe/original