lfastchoose {DPQ} | R Documentation |
Provide R versions of simple formulas for computing the logarithm of
(the absolute value of) binomial coefficients, i.e., simpler, more direct
formulas than what (the C level) code of R's lchoose()
computes.
lfastchoose(n, k) f05lchoose(n, k)
n |
a numeric vector. |
k |
a integer valued numeric vector. |
a numeric vector with the same attributes as n + k
.
Martin Maechler
lfastchoose # function(n, k) lgamma(n + 1) - lgamma(k + 1) - lgamma(n - k + 1) f05lchoose # function(n, k) lfastchoose(n = floor(n + 0.5), k = floor(k + 0.5)) ## interesting cases ?