functionNegativeBinomial

Negative Binomial

Extends from Var (prototype for variate generation functions).

Information

NegativeBinomial

Negative Binomial probability distribution function.

Syntax

NegativeBinomial(g,t,b)

Description

Generates a random variate following the Negative Binomial probability distribution function. This variate is equivalent to the sum of t random variables following the Geometric(b) distribution.

The pseudo-code algorithm used for this distribution is:

1. Generate y[1],...,y[t] as IID Geometric(p).
2. Return x = y[1]+...+y[t]

Examples


(u,g) := Negativebinomial(g,6,0.2);

Inputs

TypeNameDefaultDescription
Generatorg (from Var)Random number generator
Reala (from Var)0First parameter of the prob. distribution
Realb (from Var)0Second parameter of the prob. distribution
Realc (from Var)0Third parameter of the prob. distribution (only for the Johnson and Triangular distributions)
Reald (from Var)0Fourth parameter of the prob. distribution (only for the Johnson distribution)

Outputs

TypeNameDefaultDescription
Realx (from Var)Generated random variate
Generatorgout (from Var)Updated random number generator