Skip to contents

This set of functions revolve around the polygamma functions, i.e. the derivatives of the gamma function.

Usage

idigamma(x, ...)

Ddigamma(x, y)

Dtrigamma(x, y)

gammap(x, p, log = FALSE)

Arguments

x, y

numeric. The points to evaluate the function.

...

extra arguments passed to optim().

p

integer. The p-variate Gamma function.

log

logical. Should the logarithm of the result be returned?

Value

numeric. The evaluated function.

Details

These functions are needed for the beta and gamma distribution families (and their multivariate analogs, e.g. the Dirichlet). They appear in the estimation and the asymptotic variance-covariance matrix of the MLE and the SAME.

The idigamma() function implements the inverse of the digamma function \(\psi\). It is a numerical approximation based on the L-BFGS-U quasi-Newton algorithm. Specifically, idigamma() makes a call to optim() in order to to solve the equation \(\psi(x) = y\); more accurately, to find the minimum of \(f(x) = \log\Gamma(x) - xy\), whose derivative is \(f'(x) = \psi(x) - y\). The optimization is restricted within the tight bounds derived by Batir (2017). The function is vectorized.

Functions

  • idigamma(): inverse digamma function.

  • Ddigamma(): digamma difference function.

  • Dtrigamma(): trigamma difference function.

  • gammap(): p-variate gamma function

References

Necdet Batir (2017), INEQUALITIES FOR THE INVERSES OF THE POLYGAMMA FUNCTIONS https://arxiv.org/pdf/1705.06547

Oikonomidis, I. & Trevezas, S. (2023), Moment-Type Estimators for the Dirichlet and the Multivariate Gamma Distributions, arXiv, https://arxiv.org/abs/2311.15025

Examples

idigamma(2)
#> [1] 7.883429
Ddigamma(2, 3)
#> [1] -0.5
Dtrigamma(2, 3)
#> [1] 0.25
gammap(1:3, 3)
#> [1]       Inf  4.934802 14.804407