[Rd] RFC: d/p/q/rgamma

Kurt Hornik Kurt.Hornik@ci.tuwien.ac.at
Thu, 6 Sep 2001 10:15:43 +0200


>>>>> Prof Brian Ripley writes:

> dgamma and friends in S are documented as
> dgamma(x, shape, rate=1)
> pgamma(q, shape, rate=1)
> qgamma(p, shape, rate=1)
> rgamma(n, shape, rate=1)


> whereas R has

> dgamma(x, shape, scale=1, log = FALSE)
> pgamma(q, shape, scale=1, lower.tail = TRUE, log.p = FALSE)
> qgamma(p, shape, scale=1, lower.tail = TRUE, log.p = FALSE)
> rgamma(n, shape, scale=1)

> Note the use of rate vs scale.  Indeed, as both S and R use `rate' for
> exponential this seems somewhat strange, and the only such
> inconsistency I can find.

> I propose that we add a `rate' argument to d/p/q/rgamma as an
> alternative to `scale', which is easily done.  The question is where?

> I think we have a trap here for most users, who will happily copy

> dgamma(x, 17, 0.3)

> from their S-PLUS example sheet, and get the wrong answer. My preference
> would be to have

> dgamma(x, shape, rate, scale=1, log = FALSE)

> etc.  That would break existing R code using positional matching.
> Question: is there any?

One could find out by unpackaging all CRAN packages and grepping for
usages of *gamma in the code.

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._