Skip to content
Prev 58840 / 63424 Next

qnbinom with small size is slow

?? I can reproduce this on

R Under development (unstable) (2020-07-24 r78910)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Pop!_OS 18.04 LTS

 ? In my opinion this is worth reporting, but discussing it here first 
was a good idea.? Many more people read this list than watch the bug 
tracker, so it will get more attention here; once the excitement has 
died down here (which might be almost immediately!), if no-one has 
already volunteered to post it to the bug tracker, request 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(log10(time)~size, data=dd, subset=time>0))
On 8/7/20 2:01 PM, Constantin Ahlmann-Eltze via R-devel wrote: