-------------------------------------------------------------------------------
help for nbfit
-------------------------------------------------------------------------------

Fitting negative binomial distribution by maximum likelihood

nbfit varname [if exp] [in range] [weight] [, log ]

Description

nbfit fits a negative binomial distribution to a single variable by the method of maximum likelihood. Frequency weights may be used to fit variables given in frequency distribution form.

The distribution is here parameterised by m (estimated by the mean) and k:

Gamma(k + x) k x pr(x) = ------------ (k / (k + m)) (m / (k + m)) Gamma(k) x!

Gamma(k + x) k x = ------------ q p Gamma(k) x!

where p = m / (k + m) and q = 1 - p.

The estimation is carried out by nbreg. Its _b[_cons] is ln m and its _b[/lnalpha] is ln(1 / k).

Option

log specifies that the results of nbreg should be displayed.

Example

Hilborn and Mangel (1997, p.100) give data on incidental capture of albatrosses in the New Zealand subantarctic squid trawl fishery, 1990. (The birds get trapped accidentally in nets or trawl gear or cables.) The data are in frequency distribution form:

. input x freq 1. 0 807 2. 1 37 3. 2 27 4. 3 8 5. 4 4 6. 5 4 7. 6 1 8. 7 3 9. 8 1 10. 9 0 11. 10 0 12. 11 2 13. 12 1 14. 13 1 15. 14 0 16. 15 0 17. 16 0 18. 17 1 19. end

. nbfit x [w=freq]

Saved values

r(N) number of values used r(mean) ML estimate of m r(k) ML estimate of k r(p) ML estimate of p r(V) variance-covariance matrix of (m,k,p) (delta method)

References

Hilborn, R. and Mangel, M. 1997. The ecological detective: confronting models with data. Princeton University Press, Princeton, NJ.

Krebs, C.J. 1999. Ecological methodology. Benjamin/Cummings, Menlo Park, CA.

Rice, J.A. 1995. Mathematical statistics and data analysis. Duxbury, Belmont, CA.

Author

Nicholas J. Cox, University of Durham, U.K. n.j.cox@durham.ac.uk

Roberto G. Gutierrez, Stata Corporation rgutierrez@stata.com

Also see

On-line: help for nbreg Manual: [R] nbreg