nbinpdf
Negative binomial probability density function
Syntax
Y = nbinpdf(X,R,P)
Description
Y = nbinpdf(X,R,P)
returns the negative binomial pdf at each of the values inX
using the corresponding number of successes,R
and probability of success in a single trial,P
.X
,R
, andP
can be vectors, matrices, or multidimensional arrays that all have the same size, which is also the size ofY
. A scalar input forX
,R
, orP
is expanded to a constant array with the same dimensions as the other inputs. Note that the density function is zero unless the values inX
are integers.
The negative binomial pdf is
The simplest motivation for the negative binomial is the case of successive random trials, each having a constant probabilityP
of success. The number ofextratrials you must perform in order to observe a given numberR
of successes has a negative binomial distribution. However, consistent with a more general interpretation of the negative binomial,nbinpdf
allowsR
to be any positive value, including nonintegers. WhenR
is noninteger, the binomial coefficient in the definition of the pdf is replaced by the equivalent expression