random.negativebinomial

random.negativebinomial(mu: number, d: number) 🡒 number, pure function

Returns a deviate sampled from a negative binomial distribution of mean mu and of variance $σ^2 = d * μ$ where d is the dispersion. The mean must be non-negative. The dispersion must be greater or equal to 1.

table T = with
  [| as Mu, as Dispersion |]
  [| 0.0,  1.0 |]
  [| 1.5,  1.1 |]
  [| 5.5,  2.0 |]
  [| 10.0, 3.0 |]

show table "" a1c4 with
  T.Mu
  T.Dispersion
  random.negativebinomial(T.Mu, T.Dispersion)

When the dispersion equals 1, the function random.negativebinomial is the same as random.poisson.

See also