| Statistics Toolbox | ![]() |
Random matrices from a negative binomial distribution.
Syntax
RND = nbinrnd(R,P) RND = nbinrnd(R,P,m) RND = nbinrnd(R,P,m,n)
Description
is a matrix of random numbers chosen from a negative binomial distribution with parameters RND = nbinrnd(R,P)
R and P. Vector or matrix inputs for R and P must have the same size, which is also the size of RND. A scalar input for R or P is expanded to a constant matrix with the same dimensions as the other input.
RND = nbinrnd(R,P,m)
generates random numbers with parameters R and P, where m is a 1-by-2 vector that contains the row and column dimensions of RND.
RND = nbinrnd(R,P,m,n)
generates random numbers with parameters R and P, where scalars m and n are the row and column dimensions of RND.
The negative binomial distribution models consecutive trials, each having a constant probability P of success. The parameter R is the number of successes required before stopping.
Example
Suppose you want to simulate a process that has a defect probability of 0.01. How many units might Quality Assurance inspect before finding three defective items?
r = nbinrnd(3,0.01,1,6) + 3 r = 496 142 420 396 851 178
See Also
nbincdf, nbininv, nbinpdf, nbinstat
| nbinpdf | nbinstat | ![]() |