Skip to content

CHANGE: integer support for the Poisson distribution #1220

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

Closed
tspooner opened this issue Feb 12, 2022 · 1 comment
Closed

CHANGE: integer support for the Poisson distribution #1220

tspooner opened this issue Feb 12, 2022 · 1 comment

Comments

@tspooner
Copy link

Summary

The latest version of rand_distr implements the Poisson distribution using num_traits to generalise across floating point value outputs. However, the definition of the Poisson distribution (see, e.g., https://en.wikipedia.org/wiki/Poisson_distribution) has an integer support. This has downstream issues for various numerical and scientific computing applications.

Details

This change would replace Float + FloatConst with, e.g., PrimInt + Unsigned to align correctly with the formal specification.

Motivation

In various scientific computing applications, one needs to generate Poisson random samples. For example, in finance, we use Poisson distributions to simulate the size of incoming orders, the number of events that occurred in a fixed window, etc etc... The current implementation, however, does not neatly support this. Indeed, it's not entirely clear how one recovers an integer value from the output without casting, which may be lossy in some instances.

Alternatives

It's unclear why the choice was made to move from natural numbers to floats. I may very well be missing something entirely here, but some documentation at the very least would be useful to aid users in correct casting into integer values.

To be clear, I'm sure there is a good reason, but if that could be cleared up it would be immensely useful.

Thanks,
Thomas

@tspooner
Copy link
Author

My apologies, I can see that there is an existing issue on this topic. I will close.

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

1 participant