JuliaStats / Distributions.jl

A Julia package for probability distributions and associated functions.
Other
1.11k stars 416 forks source link

Poisson distribution support #1770

Open krishvishal opened 1 year ago

krishvishal commented 1 year ago

The λ parameter of Poisson is only defined for positive reals. But here its defined for λ >= 0.

Is this intended?

dist = Poisson(0); #no problem

dist = Poisson(-1) #ERROR: DomainError with -1.0: (as intended)
simsurace commented 1 year ago

What's the problem with Poisson(0)?

krishvishal commented 1 year ago

Poisson(0) makes the mass concentrated at zero, and turns into Dirac.

And also multiple textbooks define the rate parameter λ to be positive real.

Ref:

  1. A Modern Introduction to Probability and Statistics - page 163, section11.5
  2. https://en.wikipedia.org/wiki/Poisson_distribution - Definition section
  3. Bertsekas and Tsitisklis - Section 2.3
simsurace commented 1 year ago

Sure, if you want a proper (non-degenerate) Poisson distribution, you have to choose a positive parameter, but the same could be said about many other distributions, e.g. Bernoulli(p)as p->0. Many of those have limits (edge cases) which are still valid distribution. In numerical applications, it would be bad if the limit throws an error even though the limit is a perfectly valid distribution. For example, you may have a model where λ = exp(x) and for very negative x this can underflow.