code: def _ll_nbt(y, X, beta, alph, C=0):
      r"""
      Negative Binomial (truncated)
  
      Truncated densities for count models (Cameron & Trivedi, 2005, 680):
  
      .. math::
  
          f(y|\beta, y \geq C+1) = \frac{f(y|\beta)}{1-F(C|\beta)}
      """
      Q = 0
      mu = np.exp(np.dot(X, beta))
      size = 1 / alph * mu**Q
      prob = size / (size + mu)
      ll = nbinom.logpmf(y, size, prob) - np.log(
          1 - nbinom.cdf(C, size, prob)
      )
      return ll
  
imports: from urllib.request import urlopen
  import numpy
  from numpy.testing import assert_almost_equal
  from scipy.special import digamma
  from scipy.stats import nbinom
  import pandas
  import patsy
  from statsmodels.base.model import GenericLikelihoodModel
  from statsmodels.base.model import GenericLikelihoodModelResults
label_desc: Use image node_id 5 for calling a global function with example usage: _ll_nbt(y, X, beta, alph, C) and returns: ll