From 60656d7fe3ac74f3c70aee7b6c6c54871192bd0d Mon Sep 17 00:00:00 2001 From: stepan <stepan.sindelar@oracle.com> Date: Thu, 29 Dec 2016 15:59:29 +0100 Subject: [PATCH] Stats: port hypergeometric distribution --- .../truffle/r/library/stats/DHyper.java | 65 ++ .../oracle/truffle/r/library/stats/DPQ.java | 6 + .../truffle/r/library/stats/PHyper.java | 93 +++ .../truffle/r/library/stats/QHyper.java | 9 +- .../foreign/CallAndExternalFunctions.java | 9 + .../truffle/r/test/ExpectedTestOutput.test | 584 ++++++++++++++++++ .../test/library/stats/TestDistributions.java | 14 +- mx.fastr/copyrights/overrides | 2 + 8 files changed, 779 insertions(+), 3 deletions(-) create mode 100644 com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DHyper.java create mode 100644 com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/PHyper.java diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DHyper.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DHyper.java new file mode 100644 index 0000000000..5e9496495f --- /dev/null +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DHyper.java @@ -0,0 +1,65 @@ +/* + * This material is distributed under the GNU General Public License + * Version 2. You may review the terms of this license at + * http://www.gnu.org/licenses/gpl-2.0.html + * + * Copyright (c) 2000-2014, The R Core Team + * Copyright (c) 2016, Oracle and/or its affiliates + * + * All rights reserved. + */ +/* + * AUTHOR + * Catherine Loader, catherine@research.bell-labs.com. + * October 23, 2000. + * + */ +package com.oracle.truffle.r.library.stats; + +import static com.oracle.truffle.r.library.stats.Dbinom.dbinomRaw; + +import com.oracle.truffle.r.library.stats.DPQ.EarlyReturn; +import com.oracle.truffle.r.library.stats.StatsFunctions.Function4_1; + +public final class DHyper implements Function4_1 { + @Override + public double evaluate(double x, double r, double b, double n, boolean giveLog) { + if (Double.isNaN(x) || Double.isNaN(r) || Double.isNaN(b) || Double.isNaN(n)) { + return x + r + b + n; + } + + if (DPQ.rdneginonint(r) || DPQ.rdneginonint(b) || DPQ.rdneginonint(n) || n > r + b) { + return RMathError.defaultError(); + } + if (x < 0) { + return DPQ.rd0(giveLog); + } + + try { + DPQ.nonintCheck(x, giveLog); // incl warning + } catch (EarlyReturn e) { + return e.result; + } + + x = RMath.forceint(x); + r = RMath.forceint(r); + b = RMath.forceint(b); + n = RMath.forceint(n); + + if (n < x || r < x || n - x > b) { + return DPQ.rd0(giveLog); + } + if (n == 0) { + return (x == 0) ? DPQ.rd1(giveLog) : DPQ.rd0(giveLog); + } + + double p = n / (r + b); + double q = (r + b - n) / (r + b); + + double p1 = dbinomRaw(x, r, p, q, giveLog); + double p2 = dbinomRaw(n - x, b, p, q, giveLog); + double p3 = dbinomRaw(n, r + b, p, q, giveLog); + + return (giveLog) ? p1 + p2 - p3 : p1 * p2 / p3; + } +} diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DPQ.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DPQ.java index c8c48af38d..2ec4f83eaa 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DPQ.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DPQ.java @@ -143,6 +143,12 @@ public final class DPQ { return logP ? lowerTail ? -Math.expm1(p) : Math.exp(p) : rdcval(p, lowerTail); } + /* [neg]ative or [non int]eger : */ + // R_D_negInonint + public static boolean rdneginonint(double x) { + return x < 0. || nonint(x); + } + // R_Q_P01_boundaries public static void rqp01boundaries(double p, double left, double right, boolean lowerTail, boolean logP) throws EarlyReturn { if (logP) { diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/PHyper.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/PHyper.java new file mode 100644 index 0000000000..5a52dd6032 --- /dev/null +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/PHyper.java @@ -0,0 +1,93 @@ +/* + * This material is distributed under the GNU General Public License + * Version 2. You may review the terms of this license at + * http://www.gnu.org/licenses/gpl-2.0.html + * + * Copyright (C) 1998 Ross Ihaka + * Copyright (c) 1999-2014, The R Core Team + * Copyright (c) 2004, The R Foundation + * Copyright (c) 2016, Oracle and/or its affiliates + * + * All rights reserved. + */ +/* + * Copyright (C) 2004 Morten Welinder + * + * Current implementation based on posting + * From: Morten Welinder <terra@gnome.org> + * Cc: R-bugs@biostat.ku.dk + * Subject: [Rd] phyper accuracy and efficiency (PR#6772) + * Date: Thu, 15 Apr 2004 18:06:37 +0200 (CEST) + */ +package com.oracle.truffle.r.library.stats; + +import static com.oracle.truffle.r.library.stats.MathConstants.DBL_EPSILON; + +import com.oracle.truffle.r.library.stats.StatsFunctions.Function4_2; + +public final class PHyper implements Function4_2 { + private final DHyper dhyper = new DHyper(); + + @Override + public double evaluate(double x, double nr, double nb, double n, boolean lowerTail, boolean logP) { + /* Sample of n balls from nr red and nb black ones; x are red */ + if (Double.isNaN(x) || Double.isNaN(nr) || Double.isNaN(nb) || Double.isNaN(n)) { + return x + nr + nb + n; + } + + x = Math.floor(x + 1e-7); + nr = RMath.forceint(nr); + nb = RMath.forceint(nb); + n = RMath.forceint(n); + + if (nr < 0 || nb < 0 || !Double.isFinite(nr + nb) || n < 0 || n > nr + nb) { + return RMathError.defaultError(); + } + + if (x * (nr + nb) > n * nr) { + /* Swap tails. */ + double oldNB = nb; + nb = nr; + nr = oldNB; + x = n - x - 1; + lowerTail = !lowerTail; + } + + if (x < 0) { + return DPQ.rdt0(lowerTail, logP); + } + if (x >= nr || x >= n) { + return DPQ.rdt1(lowerTail, logP); + } + + double d = dhyper.evaluate(x, nr, nb, n, logP); + double pd = pdhyper(x, nr, nb, n, logP); + + return logP ? DPQ.rdtlog(d + pd, lowerTail, logP) : DPQ.rdlval(d * pd, lowerTail); + } + + static double pdhyper(double x, double nr, double nb, double n, boolean logP) { + /* + * Calculate + * + * phyper (x, nr, nb, n, true, false) [log] ---------------------------------- dhyper (x, + * nr, nb, n, false) + * + * without actually calling phyper. This assumes that + * + * x * (nr + nb) <= n * nr + * + */ + /* LDOUBLE */double sum = 0; + /* LDOUBLE */double term = 1; + + while (x > 0 && term >= DBL_EPSILON * sum) { + term *= x * (nb - n + x) / (n + 1 - x) / (nr + 1 - x); + sum += term; + x--; + } + + double ss = sum; + return logP ? RMath.log1p(ss) : 1 + ss; + } +} diff --git a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QHyper.java b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QHyper.java index b9bcbaca28..727442b4a6 100644 --- a/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QHyper.java +++ b/com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QHyper.java @@ -18,8 +18,14 @@ import static com.oracle.truffle.r.library.stats.RMath.forceint; import static com.oracle.truffle.r.library.stats.RMath.lfastchoose; import com.oracle.truffle.r.library.stats.DPQ.EarlyReturn; +import com.oracle.truffle.r.library.stats.StatsFunctions.Function4_2; + +public final class QHyper implements Function4_2 { + @Override + public double evaluate(double p, double nr, double nb, double n, boolean lowerTail, boolean logP) { + return qhyper(p, nr, nb, n, lowerTail, logP); + } -public final class QHyper { public static double qhyper(double pIn, double nrIn, double nbIn, double nIn, boolean lowerTail, boolean logP) { /* This is basically the same code as ./phyper.c *used* to be --> FIXME! */ if (Double.isNaN(pIn) || Double.isNaN(nrIn) || Double.isNaN(nbIn) || Double.isNaN(nIn)) { @@ -87,5 +93,4 @@ public final class QHyper { } return xr; } - } diff --git a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/CallAndExternalFunctions.java b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/CallAndExternalFunctions.java index 98c11aa7c7..41d336596c 100644 --- a/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/CallAndExternalFunctions.java +++ b/com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/foreign/CallAndExternalFunctions.java @@ -51,6 +51,7 @@ import com.oracle.truffle.r.library.stats.CompleteCases; import com.oracle.truffle.r.library.stats.CovcorNodeGen; import com.oracle.truffle.r.library.stats.CutreeNodeGen; import com.oracle.truffle.r.library.stats.DBeta; +import com.oracle.truffle.r.library.stats.DHyper; import com.oracle.truffle.r.library.stats.DNBeta; import com.oracle.truffle.r.library.stats.DNChisq; import com.oracle.truffle.r.library.stats.DNorm; @@ -77,6 +78,7 @@ import com.oracle.truffle.r.library.stats.Logis; import com.oracle.truffle.r.library.stats.Logis.DLogis; import com.oracle.truffle.r.library.stats.Logis.RLogis; import com.oracle.truffle.r.library.stats.PGamma; +import com.oracle.truffle.r.library.stats.PHyper; import com.oracle.truffle.r.library.stats.PNBeta; import com.oracle.truffle.r.library.stats.PNChisq; import com.oracle.truffle.r.library.stats.PPois; @@ -87,6 +89,7 @@ import com.oracle.truffle.r.library.stats.Pnf; import com.oracle.truffle.r.library.stats.Pnorm; import com.oracle.truffle.r.library.stats.Pt; import com.oracle.truffle.r.library.stats.QBeta; +import com.oracle.truffle.r.library.stats.QHyper; import com.oracle.truffle.r.library.stats.QNBeta; import com.oracle.truffle.r.library.stats.QNChisq; import com.oracle.truffle.r.library.stats.QPois; @@ -309,6 +312,12 @@ public class CallAndExternalFunctions { return RandFunction1Node.createInt(new RSignrank()); case "rhyper": return RandFunction3Node.createInt(new RHyper()); + case "phyper": + return StatsFunctions.Function4_2Node.create(new PHyper()); + case "dhyper": + return StatsFunctions.Function4_1Node.create(new DHyper()); + case "qhyper": + return StatsFunctions.Function4_2Node.create(new QHyper()); case "pnchisq": return StatsFunctionsFactory.Function3_2NodeGen.create(new PNChisq()); case "qnchisq": diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test index 1d8923274e..a54e3525ac 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/ExpectedTestOutput.test @@ -112188,6 +112188,154 @@ In dgamma(0, 1, Inf) : NaNs produced #dgamma(c(900, 5000, 0), 11e11, scale=23e-11, log=T) [1] -1.417138e+12 -1.735695e+13 -Inf +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, -10, 11, 4) +[1] NaN +Warning message: +In dhyper(0, -10, 11, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, -Inf, 11, 4) +[1] NaN +Warning message: +In dhyper(0, -Inf, 11, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, 0.3, 11, 4) +[1] NaN +Warning message: +In dhyper(0, 0.3, 11, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, 7, 11, -10) +[1] NaN +Warning message: +In dhyper(0, 7, 11, -10) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, 7, 11, -Inf) +[1] NaN +Warning message: +In dhyper(0, 7, 11, -Inf) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, 7, 11, 0.3) +[1] NaN +Warning message: +In dhyper(0, 7, 11, 0.3) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, 7, 11, Inf) +[1] NaN +Warning message: +In dhyper(0, 7, 11, Inf) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, 7, 11, NaN) +[1] NaN + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, 7, -10, 4) +[1] NaN +Warning message: +In dhyper(0, 7, -10, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, 7, -Inf, 4) +[1] NaN +Warning message: +In dhyper(0, 7, -Inf, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, 7, 0.3, 4) +[1] NaN +Warning message: +In dhyper(0, 7, 0.3, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, 7, Inf, 4) +[1] NaN +Warning message: +In dhyper(0, 7, Inf, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, 7, NaN, 4) +[1] NaN + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, Inf, 11, 4) +[1] NaN +Warning message: +In dhyper(0, Inf, 11, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(0, NaN, 11, 4) +[1] NaN + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(c(0.1, -Inf, Inf, 0.3e89), 5, 5, 5, log=F) +[1] 0 0 0 0 +Warning message: +In dhyper(c(0.1, -Inf, Inf, 3e+88), 5, 5, 5, log = F) : + non-integer x = 0.100000 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(c(0.1, -Inf, Inf, 0.3e89), 5, 5, 5, log=T) +[1] -Inf -Inf -Inf -Inf +Warning message: +In dhyper(c(0.1, -Inf, Inf, 3e+88), 5, 5, 5, log = T) : + non-integer x = 0.100000 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(c(1, 2, 3, 4, 20, 12e12), 7, 11, 4, log=F) +[1] 0.37745098 0.37745098 0.12581699 0.01143791 0.00000000 0.00000000 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(c(1, 2, 3, 4, 20, 12e12), 7, 11, 4, log=T) +[1] -0.9743146 -0.9743146 -2.0729269 -4.4708221 -Inf -Inf + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(c(1, 2, 3, 4, 20, 12e12), 7e12, 11, 4, log=F) +[1] 1.154519e-35 1.346939e-23 6.285714e-12 1.000000e+00 0.000000e+00 +[6] 0.000000e+00 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(c(1, 2, 3, 4, 20, 12e12), 7e12, 11, 4, log=T) +[1] -8.044679e+01 -5.266162e+01 -2.579274e+01 -6.285639e-12 -Inf +[6] -Inf + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(c(1, 2, 3, 4, 5, 6, 7, 8, 11, 20, 12e12), 7, 11, 12, log=F) + [1] 0.0003770739 0.0124434389 0.1036953243 0.3110859729 0.3733031674 + [6] 0.1742081448 0.0248868778 0.0000000000 0.0000000000 0.0000000000 +[11] 0.0000000000 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(c(1, 2, 3, 4, 5, 6, 7, 8, 11, 20, 12e12), 7, 11, 12, log=T) + [1] -7.8830694 -4.3865618 -2.2662983 -1.1676860 -0.9853644 -1.7475045 + [7] -3.6934146 -Inf -Inf -Inf -Inf + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(c(1, 2, 3, 7, 20, 12e12), 11, 7e12, 7, log=F) +[1] 1.100000e-11 4.714286e-23 1.010204e-34 2.019567e-84 0.000000e+00 +[6] 0.000000e+00 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(c(1, 2, 3, 7, 20, 12e12), 11, 7e12, 7, log=T) +[1] -25.23313 -51.40886 -78.27774 -192.71426 -Inf -Inf + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(c(2), 3, 4, 10, log=F) +[1] NaN +Warning message: +In dhyper(c(2), 3, 4, 10, log = F) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# +#dhyper(c(2), 3, 4, 10, log=T) +[1] NaN +Warning message: +In dhyper(c(2), 3, 4, 10, log = T) : NaNs produced + ##com.oracle.truffle.r.test.library.stats.TestDistributions.testDensityFunctions#Output.MayIgnoreWarningContext# #dnorm(0, -Inf, -1) [1] NaN @@ -113098,6 +113246,198 @@ In pgamma(0, 1, Inf) : NaNs produced #pgamma(c(900, 5000, 0), 11e11, scale=23e-11, lower.tail=T, log.p=T) [1] 0 0 -Inf +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, -10, 11, 4) +[1] NaN +Warning message: +In phyper(0, -10, 11, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, -Inf, 11, 4) +[1] NaN +Warning message: +In phyper(0, -Inf, 11, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, 0.3, 11, 4) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, 7, 11, -10) +[1] NaN +Warning message: +In phyper(0, 7, 11, -10) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, 7, 11, -Inf) +[1] NaN +Warning message: +In phyper(0, 7, 11, -Inf) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, 7, 11, 0.3) +[1] 1 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, 7, 11, Inf) +[1] NaN +Warning message: +In phyper(0, 7, 11, Inf) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, 7, 11, NaN) +[1] NaN + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, 7, -10, 4) +[1] NaN +Warning message: +In phyper(0, 7, -10, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, 7, -Inf, 4) +[1] NaN +Warning message: +In phyper(0, 7, -Inf, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, 7, 0.3, 4) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, 7, Inf, 4) +[1] NaN +Warning message: +In phyper(0, 7, Inf, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, 7, NaN, 4) +[1] NaN + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, Inf, 11, 4) +[1] NaN +Warning message: +In phyper(0, Inf, 11, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(0, NaN, 11, 4) +[1] NaN + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(0.1, -Inf, Inf, 0.3e89), 5, 5, 5, lower.tail=F, log.p=F) +[1] 0.9960317 1.0000000 0.0000000 0.0000000 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(0.1, -Inf, Inf, 0.3e89), 5, 5, 5, lower.tail=F, log.p=T) +[1] -0.003976148 0.000000000 -Inf -Inf + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(0.1, -Inf, Inf, 0.3e89), 5, 5, 5, lower.tail=T, log.p=F) +[1] 0.003968254 0.000000000 1.000000000 1.000000000 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(0.1, -Inf, Inf, 0.3e89), 5, 5, 5, lower.tail=T, log.p=T) +[1] -5.529429 -Inf 0.000000 0.000000 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 4, 20, 12e12), 7, 11, 4, lower.tail=F, log.p=F) +[1] 0.51470588 0.13725490 0.01143791 0.00000000 0.00000000 0.00000000 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 4, 20, 12e12), 7, 11, 4, lower.tail=F, log.p=T) +[1] -0.6641596 -1.9859155 -4.4708221 -Inf -Inf -Inf + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 4, 20, 12e12), 7, 11, 4, lower.tail=T, log.p=F) +[1] 0.4852941 0.8627451 0.9885621 1.0000000 1.0000000 1.0000000 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 4, 20, 12e12), 7, 11, 4, lower.tail=T, log.p=T) +[1] -0.72300014 -0.14763600 -0.01150382 0.00000000 0.00000000 0.00000000 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 4, 20, 12e12), 7e12, 11, 4, lower.tail=F, log.p=F) +[1] 1 1 1 0 0 0 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 4, 20, 12e12), 7e12, 11, 4, lower.tail=F, log.p=T) +[1] -1.154519e-35 -1.346939e-23 -6.285714e-12 -Inf -Inf +[6] -Inf + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 4, 20, 12e12), 7e12, 11, 4, lower.tail=T, log.p=F) +[1] 1.154519e-35 1.346939e-23 6.285714e-12 1.000000e+00 1.000000e+00 +[6] 1.000000e+00 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 4, 20, 12e12), 7e12, 11, 4, lower.tail=T, log.p=T) +[1] -80.44679 -52.66162 -25.79274 0.00000 0.00000 0.00000 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 4, 5, 6, 7, 8, 11, 20, 12e12), 7, 11, 12, lower.tail=F, log.p=F) + [1] 0.99962293 0.98717949 0.88348416 0.57239819 0.19909502 0.02488688 + [7] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 4, 5, 6, 7, 8, 11, 20, 12e12), 7, 11, 12, lower.tail=F, log.p=T) + [1] -0.000377145 -0.012903405 -0.123881913 -0.557920393 -1.613973068 + [6] -3.693414609 -Inf -Inf -Inf -Inf +[11] -Inf + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 4, 5, 6, 7, 8, 11, 20, 12e12), 7, 11, 12, lower.tail=T, log.p=F) + [1] 0.0003770739 0.0128205128 0.1165158371 0.4276018100 0.8009049774 + [6] 0.9751131222 1.0000000000 1.0000000000 1.0000000000 1.0000000000 +[11] 1.0000000000 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 4, 5, 6, 7, 8, 11, 20, 12e12), 7, 11, 12, lower.tail=T, log.p=T) + [1] -7.88306935 -4.35670883 -2.14972807 -0.84956287 -0.22201297 -0.02520179 + [7] 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 7, 20, 12e12), 11, 7e12, 7, lower.tail=F, log.p=F) +[1] 4.714286e-23 1.010204e-34 1.154519e-46 0.000000e+00 0.000000e+00 +[6] 0.000000e+00 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 7, 20, 12e12), 11, 7e12, 7, lower.tail=F, log.p=T) +[1] -51.40886 -78.27774 -105.77523 -Inf -Inf -Inf + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 7, 20, 12e12), 11, 7e12, 7, lower.tail=T, log.p=F) +[1] 1 1 1 1 1 1 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(1, 2, 3, 7, 20, 12e12), 11, 7e12, 7, lower.tail=T, log.p=T) +[1] -4.714286e-23 -1.010204e-34 -1.154519e-46 0.000000e+00 0.000000e+00 +[6] 0.000000e+00 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(2), 3, 4, 10, lower.tail=F, log.p=F) +[1] NaN +Warning message: +In phyper(c(2), 3, 4, 10, lower.tail = F, log.p = F) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(2), 3, 4, 10, lower.tail=F, log.p=T) +[1] NaN +Warning message: +In phyper(c(2), 3, 4, 10, lower.tail = F, log.p = T) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(2), 3, 4, 10, lower.tail=T, log.p=F) +[1] NaN +Warning message: +In phyper(c(2), 3, 4, 10, lower.tail = T, log.p = F) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# +#phyper(c(2), 3, 4, 10, lower.tail=T, log.p=T) +[1] NaN +Warning message: +In phyper(c(2), 3, 4, 10, lower.tail = T, log.p = T) : NaNs produced + ##com.oracle.truffle.r.test.library.stats.TestDistributions.testDistributionFunctions#Output.MayIgnoreWarningContext# #pnorm(0, -Inf, -1) [1] NaN @@ -114294,6 +114634,250 @@ In qgamma(Inf, 1, scale = 2) : NaNs produced #qgamma(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 11e11, scale=23e-11, lower.tail=T, log.p=T) [1] 0.0000 252.9955 252.9997 253.0000 253.0001 Inf Inf +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(-0.42e-38, 7, 11, 4) +[1] NaN +Warning message: +In qhyper(-4.2e-39, 7, 11, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(-42, 7, 11, 4) +[1] NaN +Warning message: +In qhyper(-42, 7, 11, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(-Inf, 7, 11, 4) +[1] NaN +Warning message: +In qhyper(-Inf, 7, 11, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, -10, 11, 4) +[1] NaN +Warning message: +In qhyper(0, -10, 11, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, -Inf, 11, 4) +[1] NaN +Warning message: +In qhyper(0, -Inf, 11, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, 0.3, 11, 4) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, 7, 11, -10) +[1] NaN +Warning message: +In qhyper(0, 7, 11, -10) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, 7, 11, -Inf) +[1] NaN +Warning message: +In qhyper(0, 7, 11, -Inf) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, 7, 11, 0.3) +[1] 0 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, 7, 11, Inf) +[1] NaN +Warning message: +In qhyper(0, 7, 11, Inf) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, 7, 11, NaN) +[1] NaN + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, 7, -10, 4) +[1] NaN +Warning message: +In qhyper(0, 7, -10, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, 7, -Inf, 4) +[1] NaN +Warning message: +In qhyper(0, 7, -Inf, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, 7, 0.3, 4) +[1] 4 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, 7, Inf, 4) +[1] NaN +Warning message: +In qhyper(0, 7, Inf, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, 7, NaN, 4) +[1] NaN + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, Inf, 11, 4) +[1] NaN +Warning message: +In qhyper(0, Inf, 11, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(0, NaN, 11, 4) +[1] NaN + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(Inf, 7, 11, 4) +[1] NaN +Warning message: +In qhyper(Inf, 7, 11, 4) : NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(NaN, 7, 11, 4) +[1] NaN + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 11, 7e12, 7, lower.tail=F, log.p=F) +[1] 7 1 0 0 0 0 0 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 11, 7e12, 7, lower.tail=T, log.p=F) +[1] 0 0 0 0 0 7 7 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 3, 4, 10, lower.tail=F, log.p=F) +[1] NaN NaN NaN NaN NaN NaN NaN +Warning message: +In qhyper(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1), 3, 4, 10, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 3, 4, 10, lower.tail=T, log.p=F) +[1] NaN NaN NaN NaN NaN NaN NaN +Warning message: +In qhyper(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1), 3, 4, 10, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 5, 5, 5, lower.tail=F, log.p=F) +[1] 5 5 4 2 2 0 0 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 5, 5, 5, lower.tail=T, log.p=F) +[1] 0 0 1 2 3 5 5 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 7, 11, 12, lower.tail=F, log.p=F) +[1] 7 7 6 5 4 1 1 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 7, 11, 12, lower.tail=T, log.p=F) +[1] 1 1 3 5 5 7 7 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 7, 11, 4, lower.tail=F, log.p=F) +[1] 4 4 3 2 1 0 0 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 7, 11, 4, lower.tail=T, log.p=F) +[1] 0 0 0 2 2 4 4 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 7e12, 11, 4, lower.tail=F, log.p=F) +[1] 4 4 4 4 4 0 0 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1), 7e12, 11, 4, lower.tail=T, log.p=F) +[1] 0 0 4 4 4 4 4 + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 11, 7e12, 7, lower.tail=F, log.p=T) +[1] NaN 1 0 0 0 0 0 +Warning message: +In qhyper(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 11, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 11, 7e12, 7, lower.tail=T, log.p=T) +[1] NaN 0 0 0 0 7 7 +Warning message: +In qhyper(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 11, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 3, 4, 10, lower.tail=F, log.p=T) +[1] NaN NaN NaN NaN NaN NaN NaN +Warning message: +In qhyper(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 3, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 3, 4, 10, lower.tail=T, log.p=T) +[1] NaN NaN NaN NaN NaN NaN NaN +Warning message: +In qhyper(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 3, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 5, 5, 5, lower.tail=F, log.p=T) +[1] NaN 5 4 2 2 0 0 +Warning message: +In qhyper(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 5, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 5, 5, 5, lower.tail=T, log.p=T) +[1] NaN 0 1 2 3 5 5 +Warning message: +In qhyper(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 5, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 7, 11, 12, lower.tail=F, log.p=T) +[1] NaN 7 6 5 4 1 1 +Warning message: +In qhyper(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 7, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 7, 11, 12, lower.tail=T, log.p=T) +[1] NaN 1 3 5 5 7 7 +Warning message: +In qhyper(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 7, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 7, 11, 4, lower.tail=F, log.p=T) +[1] NaN 4 3 2 1 0 0 +Warning message: +In qhyper(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 7, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 7, 11, 4, lower.tail=T, log.p=T) +[1] NaN 0 0 2 2 4 4 +Warning message: +In qhyper(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 7, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 7e12, 11, 4, lower.tail=F, log.p=T) +[1] NaN 4 4 4 4 0 0 +Warning message: +In qhyper(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 7e+12, : + NaNs produced + +##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# +#qhyper(log(c(0, 42e-80, 0.1, 0.5, 0.7, 1-42e-80, 1)), 7e12, 11, 4, lower.tail=T, log.p=T) +[1] NaN 0 4 4 4 4 4 +Warning message: +In qhyper(log(c(0, 4.2e-79, 0.1, 0.5, 0.7, 1 - 4.2e-79, 1)), 7e+12, : + NaNs produced + ##com.oracle.truffle.r.test.library.stats.TestDistributions.testQuantileFunctions#Output.MayIgnoreWarningContext# #qnorm(-0.42e-38, 0, -1) [1] NaN diff --git a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestDistributions.java b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestDistributions.java index 7b19e9e15a..54841d07cd 100644 --- a/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestDistributions.java +++ b/com.oracle.truffle.r.test/src/com/oracle/truffle/r/test/library/stats/TestDistributions.java @@ -103,7 +103,19 @@ public class TestDistributions extends TestBase { test("5, 5, 5", withDefaultQ("1", "10", "44", "123")). test("5, 0.12e-10, 5", withDefaultQ("1", "10", "44", "123")). test("5, 6, 0.12e-10", withDefaultQ("1", "10", "44", "123")). - test("0.12e-10, 6, 31e10", withDefaultQ("1", "10", "44", "123")) + test("0.12e-10, 6, 31e10", withDefaultQ("1", "10", "44", "123")), + // hyper-geometric: #white balls in urn, #black balls in urn, #drawn balls + distr("hyper"). + addErrorParamValues("-10", "0.3"). + test("7, 11, 4", withQuantiles("1", "2", "3", "4", "20", "12e12")). + test("7e12, 11, 4", withQuantiles("1", "2", "3", "4", "20", "12e12")). + test("11, 7e12, 7", withQuantiles("1", "2", "3", "7", "20", "12e12")). + // more drawn balls then there is white + test("7, 11, 12", withQuantiles("1", "2", "3", "4", "5", "6", "7", "8", "11", "20", "12e12")). + // this should show non-integer warnings for quantiles + test("5, 5, 5", withQuantiles("0.1", "-Inf", "Inf", "0.3e89")). + // too many drawn balls: should be error + test("3, 4, 10", withQuantiles("2")) }; // @formatter:on diff --git a/mx.fastr/copyrights/overrides b/mx.fastr/copyrights/overrides index 53f907be9d..f5cd4fc57c 100644 --- a/mx.fastr/copyrights/overrides +++ b/mx.fastr/copyrights/overrides @@ -44,6 +44,8 @@ com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DPQ.java,gnu com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Rt.java,gnu_r_ihaka_core.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/GammaFunctions.java,gnu_r_qgamma.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/QHyper.java,gnu_r_ihaka_core.copyright +com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/DHyper.java,gnu_r.core.copyright +com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/PHyper.java,gnu_r_ihaka.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Qt.java,gnu_r_ihaka.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/Pt.java,gnu_r_scan.copyright com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/stats/RHyper.java,gnu_r_ihaka.copyright -- GitLab