Lgamma: Natural logarithm of the gamma function and its derivatives.

View source: R/gamma.R

Natural logarithm of the gamma function and its derivativesR Documentation

Natural logarithm of the gamma function and its derivatives.

Description

Natural logarithm of the gamma function and its derivatives.

Usage

Lgamma(x)
Digamma(x)
Trigamma(x)

Arguments

x

A numerical matrix or vector with positive numbers in either case.

Details

We have spotted that the time savings come when there are more than 50 elements, with vector or matrix.

Value

The matrix or the vector with the resulting values.

Author(s)

Manos Papadakis

R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.

References

Abramowitz, M. and Stegun, I. A. (1972) Handbook of Mathematical Functions. New York: Dover. https://en.wikipedia.org/wiki/Abramowitz_and_Stegun provides links to the full text which is in public domain. Chapter 6: Gamma and Related Functions.

See Also

beta.mle, diri.nr2

Examples

x <- matrix( rnorm(500 * 500), ncol = 500 )
 a1 <- Lgamma(x) 
a2 <- lgamma(x) 
all.equal(as.vector(a1), as.vector(a2))

a1 <- Digamma(x) 
a2 <- digamma(x) 
all.equal(as.vector(a1), as.vector(a2))

x<-a1<-a2<-NULL

Rfast documentation built on Nov. 9, 2023, 5:06 p.m.