Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative PMF #3

Open
jiboncom opened this issue Jan 18, 2018 · 2 comments
Open

Negative PMF #3

jiboncom opened this issue Jan 18, 2018 · 2 comments

Comments

@jiboncom
Copy link

Hello,
I am trying to use PoiBin for a Maximun Likelihood estimation, but when the PMF is extremely small (e.g. e-15) it sometimes returns negative numbers. These generate an exception in most solvers

@tsakim
Copy link
Owner

tsakim commented Aug 6, 2018

Hi @jiboncom,

sorry for the late reply. For such small numbers it may indeed be a precision issue. Would you have an example where you have encountered this problem?
Numbers around e-15 could be close to the machine limit of the floating numbers. You can check the smallest representable positive number using numpy.finfo like so:

>>> import numpy as np
>>> np.finfo(float).eps
2.220446049250313e-16

Could you provide an example?

Best,
Mika

@PercyLau
Copy link

PercyLau commented Aug 7, 2018

Hi, Mika

Could you please try this code?

import numpy as np from poibin import PoiBin from scipy.stats import binom a = np.ones(100) b = PoiBin(a) print(b.pmf(0)) print(b.cdf(10))

On my desktop ( i7-4700k, Ubuntu 16.04.05), the terminal prints
-4.98906471691e-15 -8.93280946174e-16

Best,
Percy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants