lfastchoose: R versions of Simple Formulas for Logarithmic Binomial...

View source: R/hyper-dist.R

lfastchooseR Documentation

R versions of Simple Formulas for Logarithmic Binomial Coefficients

Description

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.

Usage

lfastchoose(n, k)
 f05lchoose(n, k)

Arguments

n

a numeric vector.

k

a integer valued numeric vector.

Value

a numeric vector with the same attributes as n + k.

Author(s)

Martin Maechler

See Also

lchoose.

Examples

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 ?


DPQ documentation built on Sept. 11, 2024, 8:37 p.m.