search for: qnbinom

Displaying 20 results from an estimated 33 matches for "qnbinom".

Did you mean: dnbinom
2020 Aug 10
2
qnbinom with small size is slow
Thanks Ben for verifying the issue. It is always reassuring to hear when others can reproduce the problem. I wrote a small patch that fixes the issue (https://github.com/r-devel/r-svn/pull/11): diff --git a/src/nmath/qnbinom.c b/src/nmath/qnbinom.c index b313ce56b2..d2e8d98759 100644 --- a/src/nmath/qnbinom.c +++ b/src/nmath/qnbinom.c @@ -104,6 +104,7 @@ double qnbinom(double p, double size, double prob, int lower_tail, int log_p) /* y := approx.value (Cornish-Fisher expansion) : */ z = qnorm(p, 0., 1., /*lo...
2020 Aug 07
2
qnbinom with small size is slow
Hi all, I recently noticed that `qnbinom()` can take a long time to calculate a result if the `size` argument is very small. For example qnbinom(0.5, mu = 3, size = 1e-10) takes ~30 seconds on my computer. I used gdb to step through the qnbinom.c implementation and noticed that in line 106 (https://github.com/wch/r-source/blob/f8d4d7d...
2020 Aug 21
1
qnbinom with small size is slow
...t y is decremented only if `pnbinom(y - incr, n, pr, /*l._t.*/TRUE, /*log_p*/FALSE)) < p` is FALSE. I think the solution is to move the update of y before the if. However, I need to make this slightly awkward check if incr == 1, so that the return in line 123 and the do-while block at the end of qnbinom() do not need to be modified. diff --git a/src/nmath/qnbinom.c b/src/nmath/qnbinom.c index b313ce56b2..16845d9373 100644 --- a/src/nmath/qnbinom.c +++ b/src/nmath/qnbinom.c @@ -49,10 +49,18 @@ do_search(double y, double *z, double p, double n, double pr, double incr) { if(*z >= p) { /* se...
2020 Aug 20
0
qnbinom with small size is slow
...10 Aug 2020 10:05:36 +0200 writes: > Thanks Ben for verifying the issue. It is always reassuring to hear > when others can reproduce the problem. > I wrote a small patch that fixes the issue > (https://github.com/r-devel/r-svn/pull/11): > diff --git a/src/nmath/qnbinom.c b/src/nmath/qnbinom.c > index b313ce56b2..d2e8d98759 100644 > --- a/src/nmath/qnbinom.c > +++ b/src/nmath/qnbinom.c > @@ -104,6 +104,7 @@ double qnbinom(double p, double size, double prob, > int lower_tail, int log_p) > /* y := approx.value (Cornish-Fishe...
2020 Aug 07
0
qnbinom with small size is slow
...t an account (as specified at https://www.r-project.org/bugs.html ) ? Thanks! ?? Ben Bolker For what it's worth it doesn't seem to be a threshold effect: approximately log10(time[seconds]) ~ -8 - log10(-size) over the range from 1e-6 to 1e-9 ff <- function(x) { ?? system.time(qnbinom(0.5, mu=3, size=10^x))[["elapsed"]] } svec <- seq(-5,-9,by=-0.2) res <- lapply(svec, function(x) { ??? cat(x,"\n") ??? replicate(10,ff(x)) ??? }) dd <- data.frame(size=rep(svec,each=10), ???????????????? time=unlist(res)) boxplot(log10(time)~size, dd) summary(lm(lo...
2006 Jan 28
1
PR#8528
...centrality parameters. pt(x,1) will overflow or return 0 for values < -2e154 for 64-bit=20 implementations. pcauchy works but I believe the pt function is also suppos= ed to work for=20 non integral degrees of freedom so making it work one degree of freedom via= =20 pcauchy is hardly much use. qnbinom(1e-10,1e3,1e-7,TRUE,FALSE) is slow and by varying the parameters,= =20 qnbinom can be made very slow indeed. I do not think there is anything wron= g with=20 the Cornish-Fisher expansion. It just seems that it is not always very good= =20 for the Negative Binomial distribution. In the example above...
2008 Aug 21
1
pnmath compilation failure; dylib issue?
...om.o pcauchy.o pchisq.o pexp.o pf.o pgamma.o pgeom.o phyper.o plnorm.o plogis.o pnbeta.o pnbinom.o pnchisq.o pnf.o pnmath.o pnorm.o pnt.o polygamma.o ppois.o pt.o ptukey.o punif.o pweibull.o qbeta.o qbinom.o qcauchy.o qchisq.o qexp.o qf.o qgamma.o qgeom.o qhyper.o qlnorm.o qlogis.o qnbeta.o qnbinom.o qnchisq.o qnf.o qnorm.o qnt.o qpois.o qt.o qtukey.o qunif.o qweibull.o sign.o stirlerr.o toms708.o -lgomp -F/Library/Frameworks/R.framework/.. - framework R -Wl,-framework -Wl,CoreFoundation ld: warning, duplicate dylib /Developer/SDKs/MacOSX10.4u.sdk/usr/local/ lib/libgcc_s.1.dylib ** arc...
1997 Jul 09
1
R-beta: Problem with `rpois'
There is a problem with `rpois'. It does seem to take care about the order of the arguments. This is an example: > rpois(n=1,lambda=2) [1] 3 > rpois(lambda=2,n=1) [1] 2 0 It obviously uses the first argument as the number of samples to be drawn, which is wrong. I used Version 0.49 Beta (April 23, 1997). Fredrik
1997 Jul 09
1
R-beta: Problem with `rpois'
There is a problem with `rpois'. It does seem to take care about the order of the arguments. This is an example: > rpois(n=1,lambda=2) [1] 3 > rpois(lambda=2,n=1) [1] 2 0 It obviously uses the first argument as the number of samples to be drawn, which is wrong. I used Version 0.49 Beta (April 23, 1997). Fredrik
2008 Oct 19
1
number of required trials
...s} The Negative Binomial Distribution Description Density, distribution function, quantile function and random generation for the negative binomial distribution with parameters size and prob. Usage dnbinom(x, size, prob, mu, log = FALSE) pnbinom(q, size, prob, mu, lower.tail = TRUE, log.p = FALSE) qnbinom(p, size, prob, mu, lower.tail = TRUE, log.p = FALSE) rnbinom(n, size, prob, mu) I tried finding out how to do this by using examples, but I am at a loss. Any help would be much appreciated! Marco
2009 Mar 17
3
R does not compile any more on FreeBSD 8.0-CURRENT
...o pf.o qf.o rf.o dnf.o dt.o pt.o qt.o rt.o dnt.o dchisq.o pchisq.o qchisq.o rchisq.o rnchisq.o dbinom.o pbinom.o qbinom.o rbinom.o rmultinom.o dcauchy.o pcauchy.o qcauchy.o rcauchy.o dexp.o pexp.o qexp.o rexp.o dgeom.o pgeom.o qgeom.o rgeom.o dhyper.o phyper.o qhyper.o rhyper.o dnbinom.o pnbinom.o qnbinom.o rnbinom.o dpois.o ppois.o qpois.o rpois.o dweibull.o pweibull.o qweibull.o rweibull.o dlogis.o plogis.o qlogis.o rlogis.o dnchisq.o pnchisq.o qnchisq.o dnbeta.o pnbeta.o qnbeta.o pnf.o pnt.o qnf.o qnt.o ptukey.o qtukey.o toms708.o wilcox.o signrank.o ranlib libnmath.a config.status: creating s...
2005 Aug 09
0
qpois minor bug (PR#8058)
...+ lambda; #endif if(!R_FINITE(lambda)) ML_ERR_return_NAN; R_Q_P01_boundaries(p, 0, ML_POSINF); if(lambda < 0) ML_ERR_return_NAN; if(lambda == 0) return 0; mu = lambda; sigma = sqrt(lambda); gamma = sigma; /* Note : "same" code in qpois.c, qbinom.c, qnbinom.c -- * FIXME: This is far from optimal [cancellation for p ~= 1, etc]: */ if(!lower_tail || log_p) { p = R_DT_qIv(p); /* need check again (cancellation!): */ if (p == 0.) return 0; if (p == 1.) return ML_POSINF; } /* temporary hack --- FIXME --- */ if (p + 1.01*DBL_EPSILON &...
2012 Jun 28
1
An extreme quantile of the geometric distribution
Hi, With R version 2.10.0 (2009-10-26) on Windows, I computed the p=1.e-20 quantile of the geometric distribution with parameter prob=0.1. > qgeom(1.e-20,0.1) [1] -1 But this is not possible, since X=0,1,2,... I guess that this might be a bug in the quantile function, which should use the log1p function, instead of the naive formula. Am I correct ? Best regards, Micha?l
1997 Dec 13
1
R-beta: Compile error; R-0.60.1, Solaris 2.6, gcc 2.7.2.1
...g -I../include -c dlogis.c -o dlogis.o gcc -g -I../include -c plogis.c -o plogis.o gcc -g -I../include -c qlogis.c -o qlogis.o gcc -g -I../include -c rlogis.c -o rlogis.o gcc -g -I../include -c dnbinom.c -o dnbinom.o gcc -g -I../include -c pnbinom.c -o pnbinom.o gcc -g -I../include -c qnbinom.c -o qnbinom.o gcc -g -I../include -c rnbinom.c -o rnbinom.o gcc -g -I../include -c pnchisq.c -o pnchisq.o gcc -g -I../include -c qnchisq.c -o qnchisq.o gcc -g -I../include -c dnorm.c -o dnorm.o gcc -g -I../include -c pnorm.c -o pnorm.o gcc -g -I../include -c qnorm.c -o qnorm.o gcc -g -...
1999 May 03
1
problems compiling R-0.63.3 on alpha
...-g -I../include -I../../src/include -c rhyper.c -o rhyper.o gcc -ieee_with_inexact -g -I../include -I../../src/include -c dnbinom.c -o dnbinom.o gcc -ieee_with_inexact -g -I../include -I../../src/include -c pnbinom.c -o pnbinom.o gcc -ieee_with_inexact -g -I../include -I../../src/include -c qnbinom.c -o qnbinom.o gcc -ieee_with_inexact -g -I../include -I../../src/include -c rnbinom.c -o rnbinom.o gcc -ieee_with_inexact -g -I../include -I../../src/include -c dpois.c -o dpois.o gcc -ieee_with_inexact -g -I../include -I../../src/include -c ppois.c -o ppois.o gcc -ieee_with_inexact -g -I.....
1998 Nov 06
1
DEC alpha INSTALLATION R-0.62.4
...ude -c phyper.c cc -ieee_with_inexact -g -I../../src/include -c qhyper.c cc -ieee_with_inexact -g -I../../src/include -c rhyper.c cc -ieee_with_inexact -g -I../../src/include -c dnbinom.c cc -ieee_with_inexact -g -I../../src/include -c pnbinom.c cc -ieee_with_inexact -g -I../../src/include -c qnbinom.c cc -ieee_with_inexact -g -I../../src/include -c rnbinom.c cc -ieee_with_inexact -g -I../../src/include -c dpois.c cc -ieee_with_inexact -g -I../../src/include -c ppois.c cc -ieee_with_inexact -g -I../../src/include -c qpois.c cc -ieee_with_inexact -g -I../../src/include -c rpois.c cc -ieee_w...
1999 May 03
0
compilation of R-0.63.3 on alpha (PR#183)
...lude -I../../src/include -c rhyper.c -= o = rhyper.o gcc -ieee_with_inexact -g -I../include -I../../src/include -c dnbinom.c = -o = dnbinom.o gcc -ieee_with_inexact -g -I../include -I../../src/include -c pnbinom.c = -o = pnbinom.o gcc -ieee_with_inexact -g -I../include -I../../src/include -c qnbinom.c = -o = qnbinom.o gcc -ieee_with_inexact -g -I../include -I../../src/include -c rnbinom.c = -o = rnbinom.o gcc -ieee_with_inexact -g -I../include -I../../src/include -c dpois.c -o= = dpois.o gcc -ieee_with_inexact -g -I../include -I../../src/include -c ppois.c -o= = ppois.o gcc -ieee_with...
1998 Dec 08
0
R compile problems with AIX
.../../src/include -c qhyper.c -o qhyper.o gcc -g -O2 -I../include -I../../src/include -c rhyper.c -o rhyper.o gcc -g -O2 -I../include -I../../src/include -c dnbinom.c -o dnbinom.o gcc -g -O2 -I../include -I../../src/include -c pnbinom.c -o pnbinom.o gcc -g -O2 -I../include -I../../src/include -c qnbinom.c -o qnbinom.o gcc -g -O2 -I../include -I../../src/include -c rnbinom.c -o rnbinom.o gcc -g -O2 -I../include -I../../src/include -c dpois.c -o dpois.o gcc -g -O2 -I../include -I../../src/include -c ppois.c -o ppois.o gcc -g -O2 -I../include -I../../src/include -c qpois.c -o qpois.o gcc -g -O2 -...
1998 Dec 08
0
R compile problems with AIX
.../../src/include -c qhyper.c -o qhyper.o gcc -g -O2 -I../include -I../../src/include -c rhyper.c -o rhyper.o gcc -g -O2 -I../include -I../../src/include -c dnbinom.c -o dnbinom.o gcc -g -O2 -I../include -I../../src/include -c pnbinom.c -o pnbinom.o gcc -g -O2 -I../include -I../../src/include -c qnbinom.c -o qnbinom.o gcc -g -O2 -I../include -I../../src/include -c rnbinom.c -o rnbinom.o gcc -g -O2 -I../include -I../../src/include -c dpois.c -o dpois.o gcc -g -O2 -I../include -I../../src/include -c ppois.c -o ppois.o gcc -g -O2 -I../include -I../../src/include -c qpois.c -o qpois.o gcc -g -O2 -...
2002 Jan 22
1
compile problem with bessel_i.c on IRIX64 flexor 6.5 10100655 IP35 (uname -a) (PR#1275)
...ing dgeom.d from dgeom.c making pgeom.d from pgeom.c making qgeom.d from qgeom.c making rgeom.d from rgeom.c making dhyper.d from dhyper.c making phyper.d from phyper.c making qhyper.d from qhyper.c making rhyper.d from rhyper.c making dnbinom.d from dnbinom.c making pnbinom.d from pnbinom.c making qnbinom.d from qnbinom.c making rnbinom.d from rnbinom.c making dpois.d from dpois.c making ppois.d from ppois.c making qpois.d from qpois.c making rpois.d from rpois.c making dweibull.d from dweibull.c making pweibull.d from pweibull.c making qweibull.d from qweibull.c making rweibull.d from rweibull.c ma...