From bolker@zoo.ufl.edu  Mon Oct 15 21:02:21 2001
From: bolker@zoo.ufl.edu (Ben Bolker)
Date: Mon, 15 Oct 2001 16:02:21 -0400 (EDT)
Subject: [Rd] possible bugs: boundary conditions and random distribution parameters
Message-ID: <Pine.LNX.4.30.0110151554240.22158-100000@bolker.zoo.ufl.edu>


  There are a few inconsistencies, at least, in some of the functions that
generate random deviates from particular distributions (I think they're
bugs because they're inconvenient, but maybe someone can make an argument
for the current behavior).  If people think these are really bugs I can
submit them, together or separately.

1. rlnorm(n,mean,sd) gives NaN for sd=0, rather than always returning
the mean.  This is inconsistent with rnorm(), which returns the mean.

2. rnbinom(n,prob,size) gives NaN when prob=1; always returning 0 would be
reasonable, and consistent with the output of dnbinom().  [This is
equivalent to rnbinom(n,mu=0,size) in the new parameterization.]

3. rgamma(n,shape,scale) happily returns 0 when shape=0.  However,
dgamma(x,shape=0) [and pgamma(x,shape=0)] gives NaN.  This behavior is
actually convenient for me, but I could make an argument for returning a
warning in this case.

  The fixes seem straightforward.

  Ben Bolker




-- 
318 Carr Hall                                bolker@zoo.ufl.edu
Zoology Department, University of Florida    http://www.zoo.ufl.edu/bolker
Box 118525                                   (ph)  352-392-5697
Gainesville, FL 32611-8525                   (fax) 352-392-3704

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] possible bugs: boundary conditions and random distribution parameters
Ben Bolker