Methods of fitting discrete distributions
There are three main methods* used to fit (estimate the parameters of) discrete distributions.
This finds the parameter values that give the best chance of supplying your sample (given the other assumptions, like independence, constant parameters, etc)
This finds the parameter values that make the first few population moments match your sample moments. It’s often fairly easy to do, and in many cases yields fairly reasonable estimators. It’s also sometimes used to supply starting values to ML routines.
This minimizes the chi-square goodness of fit statistic over the discrete distribution, though sometimes with larger data sets, the end-categories might be combined for convenience. It often works fairly well, and it even arguably has some advantages over ML in particular situations, but generally it must be iterated to convergence, in which case most people tend to prefer ML.
The first two methods are also used for continuous distributions; the third is usually not used in that case.
These by no means comprise an exhaustive list, and it would be quite possible to estimate parameters by minimizing the KS-statistic for example – and even (if you adjust for the discreteness), to get a joint consonance region from it, if you were so inclined.
Since you’re working in R, ML estimation is quite easy to achieve for the negative binomial. If your sample were in x
, it’s as simple as library(MASS);fitdistr (x,"negative binomial")
:
> library(MASS)
> x <- rnegbin(100,7,3)
> fitdistr (x,"negative binomial")
size mu
3.6200839 6.3701156
(0.8033929) (0.4192836)
Those are the parameter estimates and their (asymptotic) standard errors.
In the case of the Poisson distribution, MLE and MoM both estimate the Poisson parameter at the sample mean.
If you'd like to see examples, you should post some actual counts. Note that your histogram has been done with bins chosen so that the 0 and 1 categories are combined and we don't have the raw counts.
As near as I can guess, your data are roughly as follows:
Count: 0&1 2 3 4 5 6 >6
Frequency: 311 197 74 15 3 1 0
But the big numbers will be uncertain (it depends heavily on how accurately the low-counts are represented by the pixel-counts of their bar-heights) and it could be some multiple of those numbers, like twice those numbers (the raw counts affect the standard errors, so it matters whether they're about those values or twice as big)
The combining of the first two groups makes it a little bit awkward (it's possible to do, but less straightforward if you combine some categories. A lot of information is in those first two groups so it's best not to just let the default histogram lump them).
* Other methods of fitting discrete distributions are possible of course (one might match quantiles or minimise other goodness of fit statistics for example). The ones I mention appear to be the most common.
?MASS::fitdistr
, since it's already in your R distribution (see the final example at the bottom; see rnegbin for more information about that parameterization of the Negative Binomial). .... "And after finding the ML, what should I do next?" -- well at that point you have parameter estimates and standard errors. Beyond that, what do you want to achieve? -- I can't guess. $\endgroup$