Main Content


Negative binomial parameter estimates


parmhat = nbinfit(data)
[parmhat,parmci] = nbinfit(data,alpha)
[...] = nbinfit(data,alpha,options)


parmhat = nbinfit(data) returns the maximum likelihood estimates (MLEs) of the parameters of the negative binomial distribution given the data in the vector data.

[parmhat,parmci] = nbinfit(data,alpha) returns MLEs and 100(1-alpha) percent confidence intervals. By default, alpha = 0.05, which corresponds to 95% confidence intervals.

[...] = nbinfit(data,alpha,options) accepts a structure, options, that specifies control parameters for the iterative algorithm the function uses to compute maximum likelihood estimates. The negative binomial fit function accepts an options structure which you can create using the function statset. Enter statset('nbinfit') to see the names and default values of the parameters that nbinfit accepts in the options structure. See the reference page for statset for more information about these options.


The variance of a negative binomial distribution is greater than its mean. If the sample variance of the data in data is less than its sample mean, nbinfit cannot compute MLEs. You should use the poissfit function instead.

Extended Capabilities

Version History

Introduced before R2006a