def test_ztnbinom_pmf(self):
     "Test ztnbinom.pmf"
     (n, p) = (.3, .15)
     v = np.arange(1, 21)
     vals = ztnbinom(n, p).pmf(v)
     ctrl = dist.nbinom(n, p).pmf(v) / (1. - dist.nbinom(n, p).pmf(0))
     assert_almost_equal(vals, ctrl)
     #
     vals = ztnbinom(n, p).cdf(v)
     control = [ztnbinom(n, p).pmf(np.arange(1, _ + 1)).sum() for _ in v]
     assert_almost_equal(vals, control)
     #
     assert_equal(ztnbinom(n, p).ppf(vals), v)
     #
     (n, p) = (1.5, .15)
     v = np.arange(1, 21)
     vals = ztnbinom(n, p).pmf(v)
     ctrl = dist.nbinom(n, p).pmf(v) / (1. - dist.nbinom(n, p).pmf(0))
     assert_almost_equal(vals, ctrl)
     #
     vals = ztnbinom(n, p).cdf(v)
     control = [ztnbinom(n, p).pmf(np.arange(1, _ + 1)).sum() for _ in v]
     assert_almost_equal(vals, control)
     #
     assert_equal(ztnbinom(n, p).ppf(vals), v)
 def test_ztnbinom_pmf(self):
     "Test ztnbinom.pmf"
     (n, p) = (.3, .15)
     v = np.arange(1, 21)
     vals = ztnbinom(n, p).pmf(v)
     ctrl = dist.nbinom(n, p).pmf(v)/(1.-dist.nbinom(n, p).pmf(0))
     assert_almost_equal(vals, ctrl)
     #
     vals = ztnbinom(n, p).cdf(v)
     control = [ztnbinom(n, p).pmf(np.arange(1, _+1)).sum() for _ in v]
     assert_almost_equal(vals, control)
     #
     assert_equal(ztnbinom(n, p).ppf(vals), v)
     #
     (n, p) = (1.5, .15)
     v = np.arange(1, 21)
     vals = ztnbinom(n, p).pmf(v)
     ctrl = dist.nbinom(n, p).pmf(v)/(1.-dist.nbinom(n, p).pmf(0))
     assert_almost_equal(vals, ctrl)
     #
     vals = ztnbinom(n, p).cdf(v)
     control = [ztnbinom(n, p).pmf(np.arange(1, _+1)).sum() for _ in v]
     assert_almost_equal(vals, control)
     #
     assert_equal(ztnbinom(n, p).ppf(vals), v)
 def test_basic(self):
     (n, p) = (.3, .15)
     v = np.arange(0, 21)
     vals = dist.nbinom(n, p).cdf(v)
     control = [dist.nbinom(n, p).pmf(np.arange(_ + 1)).sum() for _ in v]
     assert_almost_equal(vals, control)
 def test_basic(self):
     (n, p) = (.3, .15)
     v = np.arange(0, 21)
     vals = dist.nbinom(n, p).cdf(v)
     control = [dist.nbinom(n, p).pmf(np.arange(_+1)).sum() for _ in v]
     assert_almost_equal(vals, control)