n_neg_binomial#

class n_neg_binomial(rate, dispersion, n, step=1)[source]#

An array of negative binomial trials. See cv.sample() for more explanation.

Parameters:
  • rate (float) – the rate of the process (mean, same as Poisson)

  • dispersion (float) – dispersion parameter; lower is more dispersion, i.e. 0 = infinite, ∞ = Poisson

  • n (int) – number of trials

  • step (float) – the step size to use if non-integer outputs are desired

Example:

outcomes = cv.n_neg_binomial(100, 1, 50) # 50 negative binomial trials with mean 100 and dispersion roughly equal to mean (large-mean limit)
outcomes = cv.n_neg_binomial(1, 100, 20) # 20 negative binomial trials with mean 1 and dispersion still roughly equal to mean (approximately Poisson)