Fitting negative binomial in python

distribution, python, scipy, statistics, statsmodels

Solution

Statsmodels has discrete.discrete_model.NegativeBinomial.fit(), see here: https://www.statsmodels.org/dev/generated/statsmodels.discrete.discrete_model.NegativeBinomial.fit.html#statsmodels.discrete.discrete_model.NegativeBinomial.fit

Problem

In scipy there is no support for fitting a negative binomial distribution using data (maybe due to the fact that the negative binomial in scipy is only discrete). For a normal distribution I would just do: ``` from scipy.stats import norm param = norm.fit(samp) ``` Is there something similar 'ready to use' function in any other library?

Original source