From 80c1fd45057eb9decfb780177bae24ab885113d6 Mon Sep 17 00:00:00 2001 From: Iago-lito Date: Mon, 7 Aug 2023 13:54:18 +0200 Subject: [PATCH 1/2] Fix invalid `k` letter in Poisson formula docs. For some reason, these formulae used a mixture of `k` and `x` for the same parameter. I haven't checked whether this problem is spread more widely within the docs though. --- src/distribution/poisson.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/distribution/poisson.rs b/src/distribution/poisson.rs index 0c1b2379..9879b6a8 100644 --- a/src/distribution/poisson.rs +++ b/src/distribution/poisson.rs @@ -229,7 +229,7 @@ impl Discrete for Poisson { /// # Formula /// /// ```ignore - /// (λ^k * e^(-λ)) / x! + /// (λ^x * e^(-λ)) / x! /// ``` /// /// where `λ` is the rate @@ -244,7 +244,7 @@ impl Discrete for Poisson { /// # Formula /// /// ```ignore - /// ln((λ^k * e^(-λ)) / x!) + /// ln((λ^x * e^(-λ)) / x!) /// ``` /// /// where `λ` is the rate From 73865d89b56986f7c77c47cf0ad127218e2ad232 Mon Sep 17 00:00:00 2001 From: Iago-lito Date: Sun, 10 Mar 2024 22:53:09 +0100 Subject: [PATCH 2/2] Fix invalid k letter in hypergeometric formula docs. Done according to [this comment](https://github.com/statrs-dev/statrs/pull/192#issuecomment-1986526127) I.. think? --- src/distribution/hypergeometric.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/distribution/hypergeometric.rs b/src/distribution/hypergeometric.rs index 0ac8e750..2aefe1da 100644 --- a/src/distribution/hypergeometric.rs +++ b/src/distribution/hypergeometric.rs @@ -140,8 +140,8 @@ impl DiscreteCDF for Hypergeometric { /// # Formula /// /// ```ignore - /// 1 - ((n choose k+1) * (N-n choose K-k-1)) / (N choose K) * 3_F_2(1, - /// k+1-K, k+1-n; k+2, N+k+2-K-n; 1) + /// 1 - ((n choose x+1) * (N-n choose K-x-1)) / (N choose K) * 3_F_2(1, + /// x+1-K, x+1-n; k+2, N+x+2-K-n; 1) /// ``` /// /// where `N` is population, `K` is successes, `n` is draws, @@ -150,7 +150,7 @@ impl DiscreteCDF for Hypergeometric { /// org/wiki/Generalized_hypergeometric_function) /// /// Calculated as a discrete integral over the probability mass - /// function evaluated from 0..k+1 + /// function evaluated from 0..x+1 fn cdf(&self, x: u64) -> f64 { if x < self.min() { 0.0 @@ -174,8 +174,8 @@ impl DiscreteCDF for Hypergeometric { /// # Formula /// /// ```ignore - /// 1 - ((n choose k+1) * (N-n choose K-k-1)) / (N choose K) * 3_F_2(1, - /// k+1-K, k+1-n; k+2, N+k+2-K-n; 1) + /// 1 - ((n choose x+1) * (N-n choose K-x-1)) / (N choose K) * 3_F_2(1, + /// x+1-K, x+1-n; x+2, N+x+2-K-n; 1) /// ``` /// /// where `N` is population, `K` is successes, `n` is draws, @@ -184,7 +184,7 @@ impl DiscreteCDF for Hypergeometric { /// org/wiki/Generalized_hypergeometric_function) /// /// Calculated as a discrete integral over the probability mass - /// function evaluated from (k+1)..max + /// function evaluated from (x+1)..max fn sf(&self, x: u64) -> f64 { if x < self.min() { 1.0