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

add Poisson to distribution gallery #491

Merged
merged 3 commits into from
Jul 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions docs/examples/poisson_distribution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
jupytext:
text_representation:
extension: .md
format_name: myst
kernelspec:
display_name: Python 3
language: python
name: python3
---
# Poisson Distribution

The Poisson distribution is a discrete probability distribution that expresses the probability of a given number of events occurring in a fixed interval of time (or space) if these events occur with a known constant mean rate and independently of the time since the last event.


## Probability Density Function (PDF):

```{code-cell}
---
tags: [remove-input]
mystnb:
image:
alt: Poisson Distribution PDF
---

import arviz as az
from preliz import Poisson
az.style.use('arviz-doc')
for mu in [0.5, 3, 8]:
Poisson(mu).plot_pdf();
```

## Cumulative Distribution Function (CDF):

```{code-cell}
---
tags: [remove-input]
mystnb:
image:
alt: Poisson Distribution CDF
---

for mu in [0.5, 3, 8]:
Poisson(mu).plot_cdf();
```

## Key properties and parameters:

```{eval-rst}
======== ==========================
Support :math:`x \in \mathbb{N}_0`
Mean :math:`\mu`
Variance :math:`\mu`
======== ==========================
```

**Probability Density Function (PDF):**

$$
f(x \mid \mu) = \frac{e^{-\mu}\mu^x}{x!}
$$

**Cumulative Distribution Function (CDF):**

$$
f(x \mid \mu) = \frac{\Gamma(x + 1, \mu)}{x!}
$$

where $\Gamma(x + 1, \mu)$ is the [upper incomplete gamma function](https://en.wikipedia.org/wiki/Incomplete_gamma_function).

```{seealso}
:class: seealso

**Common Alternatives:**

- [NegativeBinomial](negative_binomial_distribution.md) - The Negative Binomial is often used as an alternative the Poisson when the variance is greater than the mean (overdispersed data).
- [ZeroInflatedPoisson](zero_inflated_poisson_distribution.md) - The Zero-Inflated Poisson is used when there is an excess of zero counts in the data.
- [HurdlePoisson](hurdle_distribution.md) - The Hurdle Poisson is used when there is an excess of zero counts in the data.

**Related Distributions:**

- [Binomial](binomial_distribution.md) - The Poisson distribution can be derived as a limiting case to the binomial distribution as the number of trials goes to infinity and the expected number of successes remains fixed. See [law of rare events](https://en.wikipedia.org/wiki/Poisson_distribution#law_of_rare_events).
- [Normal](normal_distribution.md) - For sufficiently large values of $\mu$, the normal distribution with mean $\mu$ and standard deviation \sqrt{\mu} can be a good approximation to the Poisson.
```

## References

- [Wikipedia - Poisson Distribution](https://en.wikipedia.org/wiki/Poisson_distribution)





Loading