statistics-0.6.0.0: A library of statistical types, data, and functions

Portability portable experimental bos@serpentine.com

Statistics.Math

Description

Mathematical functions for statistics.

Synopsis

# Functions

Arguments

 :: Vector v Double => Double Parameter of each function. -> v Double Coefficients of each polynomial term, in increasing order. -> Double

Evaluate a series of Chebyshev polynomials. Uses Clenshaw's algorithm.

choose :: Int -> Int -> DoubleSource

The binomial coefficient.

``` 7 `choose` 3 == 35
```

## Factorial functions

Compute the factorial function n!. Returns ∞ if the input is above 170 (above which the result cannot be represented by a 64-bit `Double`).

Compute the natural logarithm of the factorial function. Gives 16 decimal digits of precision.

## Gamma functions

Arguments

 :: Double s -> Double x -> Double

Compute the incomplete gamma integral function γ(s,x). Uses Algorithm AS 239 by Shea.

Compute the logarithm of the gamma function Γ(x). Uses Algorithm AS 245 by Macleod.

Gives an accuracy of 10–12 significant decimal digits, except for small regions around x = 1 and x = 2, where the function goes to zero. For greater accuracy, use `logGammaL`.

Returns ∞ if the input is outside of the range (0 < x ≤ 1e305).

Compute the logarithm of the gamma function, Γ(x). Uses a Lanczos approximation.

This function is slower than `logGamma`, but gives 14 or more significant decimal digits of accuracy, except around x = 1 and x = 2, where the function goes to zero.

Returns ∞ if the input is outside of the range (0 < x ≤ 1e305).

# References

• Clenshaw, C.W. (1962) Chebyshev series for mathematical functions. National Physical Laboratory Mathematical Tables 5, Her Majesty's Stationery Office, London.
• Lanczos, C. (1964) A precision approximation of the gamma function. SIAM Journal on Numerical Analysis B 1:86–96. http://www.jstor.org/stable/2949767
• Macleod, A.J. (1989) Algorithm AS 245: A robust and reliable algorithm for the logarithm of the gamma function. Journal of the Royal Statistical Society, Series C (Applied Statistics) 38(2):397–402. http://www.jstor.org/stable/2348078
• Shea, B. (1988) Algorithm AS 239: Chi-squared and incomplete gamma integral. Applied Statistics 37(3):466–473. http://www.jstor.org/stable/2347328