search for: pnbinom

Displaying 20 results from an estimated 39 matches for "pnbinom".

Did you mean: pbinom
2005 Jan 05
3
strange behaviour of negative binomial
Dear list, I ran into a strange behaviour of the pnbinom function - or maybe I just made a stupid mistake. First thing is that pnbinom seems to be very slow. The other - more interesting one - is that I get two different curves when I plot the estimated density and the density given by pnbinom. Shouldn't it be the same? This is only the case, I t...
2008 Apr 17
2
pnbinom.c qnorm.c
Dear R users, I was wondering from where I could get the C source code to compute pnbinom() and qnorm() ? (I would use R in batch mode but I find the startup time prohibitive, unless there is a way to speed it up) I searched the Web and it clearly is part of the R distribution, I just don't know how to extract them. Thanking you ! Markus Loecher Princeton, NJ [[alternative HTML...
2008 Feb 10
1
Error while using fitdistr() function or goodfit() function
...: Can anyone else verify the error I got? I literally ran the following two lines interactively from the example for goodfit: dummy <- rnbinom(200, size = 1.5, prob = 0.8) gf <- goodfit(dummy, type = "nbinomial", method = "MinChisq") and got back Warning messages: 1: In pnbinom(q, size, prob, lower.tail, log.p) : NaNs produced 2: In pnbinom(q, size, prob, lower.tail, log.p) : NaNs produced Again, I hope this helps. Sincerely, Jason Q. McClintic Aswad Gurjar wrote: > Hello, > > Thanks for help.But I am facing different problem. > > I have 421 reading...
2020 Aug 10
2
qnbinom with small size is slow
...@@ 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., /*lower_tail*/TRUE, /*log_p*/FALSE); y = R_forceint(mu + sigma * (z + gamma * (z*z - 1) / 6)); + y = fmax2(0.0, y); z = pnbinom(y, size, prob, /*lower_tail*/TRUE, /*log_p*/FALSE); I used the https://github.com/r-devel/r-svn repo and its continuous integration tools to check that it doesn't break any existing tests: https://github.com/r-devel/r-svn/actions/runs/201327042 I have also requested a Bugzilla-account, but ha...
2020 Aug 21
1
qnbinom with small size is slow
Hi Martin, thanks for verifying. I agree that the Cornish-Fisher seems to struggle with the small size parameters, but I also don't have a good idea how to replace it. But I think fixing do_search() is possible: I think the problem is that when searching to the left 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 modifie...
2001 Feb 08
2
dnbinom(,size<1,)=0 (PR#842)
...ogram works for Rw1021. -YP- x_ c(70, 38, 17, 10, 9, 6) kk_ 0:5 n_ sum(x) dnbinom_ function(x,n,p){ gamma(x+n)/gamma(n)/gamma(x+1)*p^n * (1-p)^x } fn_ function(p){ r_ p[1] th_ p[2] ll _ -sum(x[1:max(kk)]*log(dnbinom(kk[-length(kk)],r,th))) - x[length(kk)]*log(1-pnbinom((max(kk)-1),r,th)) return(ll) } a_ nlm(fn,p=c(.9,.5),hes=T) est_ a$est phat_ c(dnbinom(kk[-length(kk)],est[1],est[2]), 1-pnbinom((max(kk)-1),est[1],est[2])) E_ n*phat chi2_ sum((x-E)^2/E) cat('Chi2 goodness-of-fit = ',chi2,'\n') cat('P-value=',1-pchisq(chi2,df=...
1999 Apr 09
7
Error in ppois function (PR#161)
Full_Name: Murray H Smith Version: 0.63.3 OS: Windows NT Submission from: (NULL) (130.216.5.57) The ppois function is displaced by -0.5. Try: > ppois(-0.5,1) [1] 0.3678794 > ppois(-0.51,1) [1] 0 > ppois(0,1) [1] 0.3678794 and > par(mfrow=c(2,1)) > x<-seq(-1,5,0.01) > plot(x,ppois(x,1),type="s",ylab="F(x)",main="Poisson CDF?") >
2020 Aug 20
0
qnbinom with small size is slow
...size, double prob, > int lower_tail, int log_p) > /* y := approx.value (Cornish-Fisher expansion) : */ > z = qnorm(p, 0., 1., /*lower_tail*/TRUE, /*log_p*/FALSE); > y = R_forceint(mu + sigma * (z + gamma * (z*z - 1) / 6)); > + y = fmax2(0.0, y); > z = pnbinom(y, size, prob, /*lower_tail*/TRUE, /*log_p*/FALSE); > I used the https://github.com/r-devel/r-svn repo and its continuous > integration tools to check that it doesn't break any existing tests: > https://github.com/r-devel/r-svn/actions/runs/201327042 > I have also...
2008 Aug 21
1
pnmath compilation failure; dylib issue?
...dnbeta.o dnbinom.o dnchisq.o dnf.o dnorm.o dnt.o dpois.o dt.o dunif.o dweibull.o fmax2.o fmin2.o ftrunc.o gamma.o gamma_cody.o i1mach.o imax2.o imin2.o lbeta.o lgamma.o lgammacor.o mlutils.o pbeta.o pbinom.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 stirle...
2020 Aug 07
2
qnbinom with small size is slow
...gdb to step through the qnbinom.c implementation and noticed that in line 106 (https://github.com/wch/r-source/blob/f8d4d7d48051860cc695b99db9be9cf439aee743/src/nmath/qnbinom.c#L106) `y` becomes a very large negative number. Later in the function `y` is (as far as I can see) only used as input for `pnbinom()` which is why I would assume that it should be a non-negative integer. I was wondering if this behavior could be considered a bug and should be reported on the bugzilla? I read the instructions at https://www.r-project.org/bugs.html and wasn't quite sure, so I decided to ask here first :) B...
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
...nomial function may do the job (not sure): NegBinomial {stats} 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
...norm.o df.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:...
2001 Feb 07
3
Goodness of fit to Poisson / NegBinomial
All, I have some data on parasites on apple leaves and want to do a goodness of fit test to a Poisson distribution. This seems to do it: mites <- c(rep(0,70), rep(1,38), rep(2,17), rep(3,10), rep(4,9), rep(5,3), rep(6,2), rep(7,1)) tab <- table(mites) NSU <- length(mites) N <-
2020 Aug 07
0
qnbinom with small size is slow
...the qnbinom.c implementation and noticed > that in line 106 > (https://github.com/wch/r-source/blob/f8d4d7d48051860cc695b99db9be9cf439aee743/src/nmath/qnbinom.c#L106) > `y` becomes a very large negative number. Later in the function `y` is > (as far as I can see) only used as input for `pnbinom()` which is why > I would assume that it should be a non-negative integer. > > I was wondering if this behavior could be considered a bug and should > be reported on the bugzilla? I read the instructions at > https://www.r-project.org/bugs.html and wasn't quite sure, so I > de...
2008 Feb 11
0
Testing for differecnes between groups, need help to find the right test in R. (Kes Knave)
...: Can anyone else verify the error I got? I literally ran the following two lines interactively from the example for goodfit: dummy <- rnbinom(200, size = 1.5, prob = 0.8) gf <- goodfit(dummy, type = "nbinomial", method = "MinChisq") and got back Warning messages: 1: In pnbinom(q, size, prob, lower.tail, log.p) : NaNs produced 2: In pnbinom(q, size, prob, lower.tail, log.p) : NaNs produced Again, I hope this helps. Sincerely, Jason Q. McClintic Aswad Gurjar wrote: > Hello, > > Thanks for help.But I am facing different problem. > > I have 421 reading...
1997 Dec 13
1
R-beta: Compile error; R-0.60.1, Solaris 2.6, gcc 2.7.2.1
...-g -I../include -c rlnorm.c -o rlnorm.o gcc -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...
2008 Aug 25
0
R 2.7.2 is released
...outf8 used by some graphics devices. o Plots of profile.mle() objects (package 'stats4') were misbehaving when the 'which' argument had been used in their calculation. o dnbinom(x, size, mu=*, ..) is now more accurate for very large 'size'. The same applies to pnbinom() and rnbinom(). o axis() was ignoring par() mgp[3] if mgp was set in-line. o Closing an X11 View() or dataentry window via its frame's close control now works better on some window managers. o Calling lapply() was not handling method dispatch correctly for is.numeric(), is.mat...
2008 Aug 25
0
R 2.7.2 is released
...outf8 used by some graphics devices. o Plots of profile.mle() objects (package 'stats4') were misbehaving when the 'which' argument had been used in their calculation. o dnbinom(x, size, mu=*, ..) is now more accurate for very large 'size'. The same applies to pnbinom() and rnbinom(). o axis() was ignoring par() mgp[3] if mgp was set in-line. o Closing an X11 View() or dataentry window via its frame's close control now works better on some window managers. o Calling lapply() was not handling method dispatch correctly for is.numeric(), is.mat...