Estimating k for the negative binomial distribution
k can be estimated in a number of different ways, some approximate, some precise. We will give one approximate method with a worked example, and also the maximum likelihood method which would usually be done by computer.
Algebraically speaking 
We can rearrange the formula for the variance above to give the following formula for k:
k  =  m^{2} 

(s^{2} − m) 
where
 m is the mean number of individuals per sampling unit
 s^{2} is the variance of individuals per sampling unit.
This provides what is known as the moment estimate which is a reasonable approximation under these conditions:
 for small values of m when k/m > 6,
 for large values of m when k > 13,
 for intermediate values of m, when (k+m)(k+2)/m ≥15.

Algebraically speaking 
Alternatively you can use the maximum likelihood estimator, which is now available on many computer packages:
N × log_{e}  ( 
1 + 
 ) 
= 
Σ  ( 
A_{r}  ) 
 
k  k + r 
 
Where
 A_{r} is the sum of the observed frequencies containing more than r individuals.
 k is the estimated value of k.
This must be solved iteratively and is best done on a computer. It assumes the frequency distribution is smooth and does not have any extremely large values.

Worked example
Number of acanthocephalan parasites in ducks 
Number of parasites 
Number observed 
Number predicted 
0 1 2 3 4 5 6 7 8
No. hosts No. parasites 
164 147 92 43 25 11 3 0 1 486 641 
162.4 149.6 91.4 46.5 21.2 9.0 3.7 1.4 0.5 
 
Variance = 1.863
Mean = 1.319
Approximate value of k = 1.319^{2} / (1.863 − 1.319) = 3.20
Maximum likelihood estimate of k = 3.054 ± SE 0.726