[R] Re: [Rd] dnbinom(,size<1,)=0 (PR#842)

Catherine Loader catherine at research.bell-labs.com
Fri Feb 9 13:15:25 CET 2001

my current code for dnbinom.c has
  prob = dbinom_raw(n,x+n,p,1-p,give_log);
  f = ((double)n)/((double)(n+x));
  return((give_log) ? log(f) + prob : f*prob);
which should work for x>=0, n>=0, 0<=p<=1.

dbinom.raw(x,n,p) is intended to work for x>=0, n>=0, 0<=p<=1,
without integer checks. When necessary (ie. for x in the dnbinom case)
the checks should be done in the calling function.

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list