From 60c0cd7939b4b3e7d8506a6a503955503b99434b Mon Sep 17 00:00:00 2001 From: aloctavodia Date: Tue, 9 Jul 2024 11:51:18 -0300 Subject: [PATCH 1/3] add Poisson to distribution gallery --- docs/examples/poisson.md | 93 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 docs/examples/poisson.md diff --git a/docs/examples/poisson.md b/docs/examples/poisson.md new file mode 100644 index 00000000..b902f722 --- /dev/null +++ b/docs/examples/poisson.md @@ -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.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.md) - The Zero-Inflated Poisson is used when there is an excess of zero counts in the data. +- [HurdlePoisson](hurdle.md) - The Hurdle Poisson is used when there is an excess of zero counts in the data. + +**Related Distributions:** + +- [Binomial](binomial.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.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) + + + + + From 76691153ab5908eb90e21f7774be322a111f692c Mon Sep 17 00:00:00 2001 From: aloctavodia Date: Tue, 9 Jul 2024 12:02:12 -0300 Subject: [PATCH 2/3] rename file --- docs/examples/{poisson.md => poisson_distribution.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/examples/{poisson.md => poisson_distribution.md} (100%) diff --git a/docs/examples/poisson.md b/docs/examples/poisson_distribution.md similarity index 100% rename from docs/examples/poisson.md rename to docs/examples/poisson_distribution.md From 00064cff27244d94e562b7445c2dc02e2c41a053 Mon Sep 17 00:00:00 2001 From: aloctavodia Date: Tue, 9 Jul 2024 12:08:27 -0300 Subject: [PATCH 3/3] fix internal links --- docs/examples/poisson_distribution.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/examples/poisson_distribution.md b/docs/examples/poisson_distribution.md index b902f722..d74cb4b0 100644 --- a/docs/examples/poisson_distribution.md +++ b/docs/examples/poisson_distribution.md @@ -73,14 +73,14 @@ where $\Gamma(x + 1, \mu)$ is the [upper incomplete gamma function](https://en.w **Common Alternatives:** -- [NegativeBinomial](negative_binomial.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.md) - The Zero-Inflated Poisson is used when there is an excess of zero counts in the data. -- [HurdlePoisson](hurdle.md) - The Hurdle Poisson is used when there is an excess of zero counts in the data. +- [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.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.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. +- [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