Computes the digamma function \(\psi(x) = d/dx \log \Gamma(x)\) elementwise
over x, via an asymptotic expansion with a recurrence (reflection)
shift for small arguments to keep the expansion accurate — the standard
technique for evaluating digamma/trigamma to double precision without a
lookup table. Used internally inside the package's negative-binomial, beta,
zero-inflated/hurdle, and KK21 count-response likelihood, score, and Hessian
kernels (wherever a Poisson/NegBin/Beta log-likelihood derivative requires
\(\psi\)), and exported standalone because it is consistently faster than
base R's digamma — measured at 6.78x on a length-5000
vector (see the
"Utility
/ Math Kernel Performance" benchmark report for the full methodology and
per-kernel results).
References
Abramowitz, M., and Stegun, I. A. (1972). Handbook of
Mathematical Functions, Section 6.3, for the asymptotic expansion and
recurrence relation used. See also
digamma function for
orientation. Analogous Python API:
SciPy
digamma.
