class_docstr: Zero-Inflated Negative binomial log-likelihood.
  The Zero-inflated version of the Negative Binomial (NB).
  The NB distribution describes a Poisson random variable
  whose rate parameter is gamma distributed.
  The pmf of this distribution is
  
  .. math::
  
     f(x \mid \psi, \mu, \alpha) = \left\{
       \begin{array}{l}
         (1-\psi) + \psi \left (
           \frac{\alpha}{\alpha+\mu}
         \right) ^\alpha, \text{if } x = 0 \\
         \psi \frac{\Gamma(x+\alpha)}{x! \Gamma(\alpha)} \left (
           \frac{\alpha}{\mu+\alpha}
         \right)^\alpha \left(
           \frac{\mu}{\mu+\alpha}
         \right)^x, \text{if } x=1,2,3,\ldots
       \end{array}
     \right.
  
  .. plot::
      :context: close-figs
  
      import matplotlib.pyplot as plt
      import numpy as np
      import scipy.stats as st
      from scipy import special
      import arviz as az
      plt.style.use('arviz-darkgrid')
      def ZeroInfNegBinom(a, m, psi, x):
          pmf = special.binom(x + a - 1, x) * (a / (m + a))**a * (m / (m + a))**x
          pmf[0] = (1 - psi) + pmf[0]
          pmf[1:] =  psi * pmf[1:]
          pmf /= pmf.sum()
          return pmf
      x = np.arange(0, 25)
      alphas = [2, 4]
      mus = [2, 8]
      psis = [0.7, 0.7]
      for a, m, psi in zip(alphas, mus, psis):
          pmf = ZeroInfNegBinom(a, m, psi, x)
          plt.plot(x, pmf, '-o', label=r'$\alpha$ = {}, $\mu$ = {}, $\psi$ = {}'.format(a, m, psi))
      plt.xlabel('x', fontsize=12)
      plt.ylabel('f(x)', fontsize=12)
      plt.legend(loc=1)
      plt.show()
  
  ========  ==========================
  Support   :math:`x \in \mathbb{N}_0`
  Mean      :math:`\psi\mu`
  Var       :math:`\psi\mu +  \left (1 + \frac{\mu}{\alpha} + \frac{1-\psi}{\mu} \right)`
  ========  ==========================
  
  The zero inflated negative binomial distribution can be parametrized
  either in terms of mu or p, and either in terms of alpha or n.
  The link between the parametrizations is given by
  
  .. math::
  
      \mu &= \frac{n(1-p)}{p} \\
      \alpha &= n
  
  Parameters
  ----------
  psi : tensor_like of float
      Expected proportion of NegativeBinomial variates (0 < psi < 1)
  mu : tensor_like of float
      Poisson distribution parameter (mu > 0).
  alpha : tensor_like of float
      Gamma distribution parameter (alpha > 0).
  p : tensor_like of float
      Alternative probability of success in each trial (0 < p < 1).
  n : tensor_like of float
      Alternative number of target success trials (n > 0)
class_docstr_tok: ["Zero-Inflated","Negative","binomial","log-likelihood",".","The","Zero-inflated","version","of","the","Negative","Binomial","(","NB",")",".","The","NB","distribution","describes","a","Poisson","random","variable","whose","rate","parameter","is","gamma","distributed",".","The","pmf","of","this","distribution","is","..","math",":",":","f","(","x","\\mid","\\psi",",","\\mu",",","\\alpha",")","=","\\left\\","{","\\begin","{","array","}","{","l","}","(","1-\\psi",")","+","\\psi","\\left","(","\\frac","{","\\alpha","}","{","\\alpha+\\mu","}","\\right",")","^\\alpha",",","\\text","{","if","}","x","=","0","\\\\","\\psi","\\frac","{","\\Gamma","(","x+\\alpha",")","}","{","x","!","\\Gamma","(","\\alpha",")","}","\\left","(","\\frac","{","\\alpha","}","{","\\mu+\\alpha","}","\\right",")","^\\alpha","\\left","(","\\frac","{","\\mu","}","{","\\mu+\\alpha","}","\\right",")","^x",",","\\text","{","if","}","x=1,2,3",",","\\ldots","\\end","{","array","}","\\right",".","..","plot",":",":",":","context",":","close-figs","import","matplotlib.pyplot","as","plt","import","numpy","as","np","import","scipy.stats","as","st","from","scipy","import","special","import","arviz","as","az","plt.style.use","(","'arviz-darkgrid","'",")","def","ZeroInfNegBinom","(","a",",","m",",","psi",",","x",")",":","pmf","=","special.binom","(","x","+","a","-","1",",","x",")","*","(","a","\/","(","m","+","a",")",")","*","*","a","*","(","m","\/","(","m","+","a",")",")","*","*","x","pmf","[","0","]","=","(","1","-","psi",")","+","pmf","[","0","]","pmf","[","1",":","]","=","psi","*","pmf","[","1",":","]","pmf","\/=","pmf.sum","(",")","return","pmf","x","=","np.arange","(","0",",","25",")","alphas","=","[","2",",","4","]","mus","=","[","2",",","8","]","psis","=","[","0.7",",","0.7","]","for","a",",","m",",","psi","in","zip","(","alphas",",","mus",",","psis",")",":","pmf","=","ZeroInfNegBinom","(","a",",","m",",","psi",",","x",")","plt.plot","(","x",",","pmf",",","'-o","'",",","label=r","'","$","\\alpha","$","=","{","}",",","$","\\mu","$","=","{","}",",","$","\\psi","$","=","{","}","'.format","(","a",",","m",",","psi",")",")","plt.xlabel","(","'","x","'",",","fontsize=12",")","plt.ylabel","(","'","f","(","x",")","'",",","fontsize=12",")","plt.legend","(","loc=1",")","plt.show","(",")","========","==========================","Support",":","math",":","`","x","\\in","\\mathbb","{","N","}","_0","`","Mean",":","math",":","`","\\psi\\mu","`","Var",":","math",":","`","\\psi\\mu","+","\\left","(","1","+","\\frac","{","\\mu","}","{","\\alpha","}","+","\\frac","{","1-\\psi","}","{","\\mu","}","\\right",")","`","========","==========================","The","zero","inflated","negative","binomial","distribution","can","be","parametrized","either","in","terms","of","mu","or","p",",","and","either","in","terms","of","alpha","or","n.","The","link","between","the","parametrizations","is","given","by","..","math",":",":","\\mu","&","=","\\frac","{","n","(","1-p",")","}","{","p","}","\\\\","\\alpha","&","=","n","Parameters","--","--","--","--","--","psi",":","tensor_like","of","float","Expected","proportion","of","NegativeBinomial","variates","(","0","<","psi","<","1",")","mu",":","tensor_like","of","float","Poisson","distribution","parameter","(","mu",">","0",")",".","alpha",":","tensor_like","of","float","Gamma","distribution","parameter","(","alpha",">","0",")",".","p",":","tensor_like","of","float","Alternative","probability","of","success","in","each","trial","(","0","<","p","<","1",")",".","n",":","tensor_like","of","float","Alternative","number","of","target","success","trials","(","n",">","0",")"]
code: def dist(cls, psi, mu=None, alpha=None, p=None, n=None, **kwargs):
      return _zero_inflated_mixture(
          name=None,
          nonzero_p=psi,
          nonzero_dist=NegativeBinomial.dist(
              mu=mu, alpha=alpha, p=p, n=n
          ),
          **kwargs,
      )
  
imports: import warnings
  import numpy
  import pytensor
  import pytensor.tensor
  from pytensor.graph.basic import Node, equal_computations
  from pytensor.tensor import TensorVariable
  from pytensor.tensor.random.op import RandomVariable
  from pymc.distributions import transforms
  from pymc.distributions.continuous import Gamma, LogNormal, Normal, get_tau_sigma
  from pymc.distributions.discrete import Binomial, NegativeBinomial, Poisson
  from pymc.distributions.dist_math import check_parameters
  from pymc.distributions.distribution import DiracDelta, Distribution, SymbolicRandomVariable, _moment, moment
  from pymc.distributions.shape_utils import _change_dist_size, change_dist_size
  from pymc.distributions.transforms import _default_transform
  from pymc.distributions.truncated import Truncated
  from pymc.logprob.abstract import _logcdf, _logcdf_helper, _logprob
  from pymc.logprob.basic import logp
  from pymc.logprob.transforms import IntervalTransform
  from pymc.pytensorf import floatX
  from pymc.util import check_dist_not_registered
  from pymc.vartypes import continuous_types, discrete_types
label_desc: Use image node_id 2 for calling the ZeroInflatedNegativeBinomial obj's underlying member method code with example usage: obj.dist(cls, psi, mu, alpha, p, n) and returns: _zero_inflated_mixture