stirmat: Calculate a matrix of Stirling numbers of the first kind

Description Usage Arguments Details Value References See Also Examples

View source: R/stirmat.R

Description

Returns a matrix of Stirling numbers of the first kind

Usage

1
stirmat(n, m)

Arguments

n

The first parameter for Stirling numbers

m

The second parameter for Stirling numbers

Details

Stirling numbers of the first (and second) kind are useful numbers for combinatorics. In the context of sequence analysis, Stirling numbers of the first kind have entered into the calculation of statistics that measure expected numbers of alleles in a population.

Stirling numbers are characterized by two parameters, 'n' and 'm' (or 'n' and 'k' in some literature). 'stirmat' returns an n by m matrix of all the respective Stirling numbers using a recursion relationship.

‘stirmat' is a direct port of the code from James Cai’s PGEToolbox, which was originally written for Matlab.

Value

A matrix with n rows and m columns, the elements of which are Stirling numbers of the first kind, for all combinations of n and m up to the supplied n and m and column, respectively

References

Cai, J.J. (2008) PGEToolsbox: A Matlab toolbox for population genetics and evolution. J Hered 99(4):438-40

See Also

'lstirling' for a logarithmic estimator of large Stirling numbers

Examples

1
2
3
4
5
n <- 20
m <- 10
stirling_matrix <- stirmat(n, m)
stirling_matrix[n,m]
# 3.819221e+14

swainechen/hfufs documentation built on June 22, 2020, 7:02 a.m.