Function Reference: nbinrnd

statistics: rnd = nbinrnd (r, ps)
statistics: rnd = nbinrnd (r, ps, rows)
statistics: rnd = nbinrnd (r, ps, rows, cols, …)
statistics: rnd = nbinrnd (r, ps, [sz])

Random arrays from the negative binomial distribution.

rnd = nbinrnd (r, ps) returns an array of random numbers chosen from the negative binomial distribution with parameters r and ps, where r is the number of successes until the experiment is stopped and ps is the probability of success in each experiment, given the number of failures in x. The size of rnd is the common size of r and ps. A scalar input functions as a constant matrix of the same size as the other inputs.

When called with a single size argument, return a square matrix with the dimension specified. When called with more than one scalar argument the first two arguments are taken as the number of rows and columns and any further arguments specify additional matrix dimensions. The size may also be specified with a vector of dimensions sz.

When r is an integer, the negative binomial distribution is also known as the Pascal distribution and it models the number of failures in x before a specified number of successes is reached in a series of independent, identical trials. Its parameters are the probability of success in a single trial, ps, and the number of successes, r. A special case of the negative binomial distribution, when r = 1, is the geometric distribution, which models the number of failures before the first success.

r can also have non-integer positive values, in which form the negative binomial distribution, also known as the Polya distribution, has no interpretation in terms of repeated trials, but, like the Poisson distribution, it is useful in modeling count data. The negative binomial distribution is more general than the Poisson distribution because it has a variance that is greater than its mean, making it suitable for count data that do not meet the assumptions of the Poisson distribution. In the limit, as r increases to infinity, the negative binomial distribution approaches the Poisson distribution.

Further information about the negative binomial distribution can be found at https://en.wikipedia.org/wiki/Negative_binomial_distribution

See also: nbininv, nbininv, nbinpdf, nbinfit, nbinlike, nbinstat

Source Code: nbinrnd