summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Laboissière <rafael@debian.org>2024-05-18 02:56:11 -0300
committerRafael Laboissière <rafael@debian.org>2024-05-18 02:57:58 -0300
commit79753f03b753f851db057b4ff5fdaa7c3b60bbc1 (patch)
tree97ef6537e4b7dddf885683e3cd8590132193358e
parent1a4e55a00da13f8fe40414b8d7e96b8af42e4e38 (diff)
d/p/binomial-dist-median.patch: Drop patch (applied upstream)
-rw-r--r--debian/patches/binomial-dist-median.patch66
-rw-r--r--debian/patches/series1
2 files changed, 0 insertions, 67 deletions
diff --git a/debian/patches/binomial-dist-median.patch b/debian/patches/binomial-dist-median.patch
deleted file mode 100644
index 4636e64..0000000
--- a/debian/patches/binomial-dist-median.patch
+++ /dev/null
@@ -1,66 +0,0 @@
-Description: Fix median method of BinomialDistribution
-Author: Rafael Laboissière <rafael@laboissiere.net>
-Origin: upstream, https://github.com/gnu-octave/statistics/issues/142
-Last-Update: 2024-03-21
-
-From 8fdd588eb46a25e9ed9c3ab42286e44276632bf1 Mon Sep 17 00:00:00 2001
-From: Rafael Laboissière <rafael@laboissiere.net>
-Date: Tue, 19 Mar 2024 11:57:34 +0100
-Subject: [PATCH] Correct median value of binomial distribution when p = 0.5
- and N is odd
-
-For a thorough discussion on this issue, see:
-
-Nowakowski S (2021) Uniqueness of a median of a binomial distribution with
-rational probability. Advances in Mathematics: Scientific Journal
-10(4):1951-1958. (http://dx.doi.org/10.37418/amsj.10.4.9)
-
-Essentially, when p = 0.5 and N is odd, there would be two "median
-values" (both integer values around N/2). In this case, the median value
-should be the fully trimmed mid-range, which happens to be equal to the
-mean value.
-
-Notice that these changes only cope with the untruncated case. For the
-general truncated case, the solution seems not to be straightforward.
-In particular, the code below:
-
-```
-pd = BinomialDistribution (5, 0.5);
-t = truncate (pd, 0, 5)
-t.median ()
-```
-
-will produce value `3`, which is wrong (it should be `2.5`).
-
-At any rate, this change is bug-compatible with Matlab, thanks to the
-use of `__traditional_()`.
----
- inst/dist_obj/BinomialDistribution.m | 8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/inst/dist_obj/BinomialDistribution.m b/inst/dist_obj/BinomialDistribution.m
-index c87e606b..3a1c5641 100644
---- a/inst/dist_obj/BinomialDistribution.m
-+++ b/inst/dist_obj/BinomialDistribution.m
-@@ -284,7 +284,11 @@ function disp (this)
- Fa_b = binocdf ([lx, ux], this.N, this.p);
- m = binoinv (sum (Fa_b) / 2, this.N, this.p);
- else
-- m = binoinv (0.5, this.N, this.p);
-+ if (! __traditional__() & this.p == 0.5 & rem (this.N, 2) == 1)
-+ m = this.mean ();
-+ else
-+ m = binoinv (0.5, this.N, this.p);
-+ endif
- endif
- endfunction
-
-@@ -662,7 +666,7 @@ function checkparams (N, p)
- #%!assert (iqr (t), 1);
- %!assert (mean (pd), 2.5, 1e-10);
- #%!assert (mean (t), 2.8, 1e-10);
--%!assert (median (pd), 3);
-+%!assert (median (pd), 2.5);
- #%!assert (median (t), 3);
- %!assert (pdf (pd, [0:5]), [0.0312, 0.1562, 0.3125, 0.3125, 0.1562, 0.0312], 1e-4);
- #%!assert (pdf (t, [0:5]), [0, 0, 0.4, 0.4, 0.2, 0], 1e-4);
diff --git a/debian/patches/series b/debian/patches/series
index 654a050..0eb84cb 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1 @@
-binomial-dist-median.patch
fpdf-reproducile-bist.patch