[SciPy-User] why do the discrete distributions not have a `fit`?

Ralf Gommers ralf.gommers at googlemail.com
Sun May 20 13:14:41 EDT 2012


On Fri, May 11, 2012 at 2:04 AM, <josef.pktd at gmail.com> wrote:

> Why do the discrete distributions not have a `fit` method like the
> continuous distributions?
>
> currently it's a bug in the documentation
> http://projects.scipy.org/scipy/ticket/1659
>
> in statsmodels, we fit several of the discrete distributions.
>

Which ones? And do you then return non-integer parameters or not?


> How about discrete parameters?   (in analogy to the erlang discussion)
>
> hypergeom is based on a story about marbles or balls
>
> http://en.wikipedia.org/wiki/Hypergeometric_distribution#Application_and_example
> but why should we care, it's just a discrete distribution with 3 shape
> parameters, isn't it?
>
> fractional marbles ?
>
> >>> nn = np.linspace(4.5, 8, 101)
> >>> pmf = [stats.hypergeom.pmf(5, 10.8, n, 8.5) for n in nn]
>
> >>> plt.plot(nn, pmf, '-o')
> >>> plt.title("pmf of hypergeom as function of parameter n")
>
> Doesn't look like there are any problems, and the likelihood function
> is nicely concave.
>
> conclusion: scipy.stats doesn't have a hypergeometric distribution,
> but a generalized version that is defined on a real parameter space.
>
> Josef
> (so what's the point? Sorry, I was just getting distracted while
> looking for `fit`.)
>

For functions that work with continuous input, perhaps using the continuous
fit and then looking for the best-fit with integer params near the
continuous optimum would work. I looked for literature on this topic, but
didn't find anything useful yet.

Ralf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20120520/3ac18957/attachment.html>


More information about the SciPy-User mailing list