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

lfastchoose {DPQ} | R 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 ?

[Package DPQ version 0.5-2 Index]