Skip to content

better derivative of lgamma and digamma stability #505

Open
@bob-carpenter

Description

@bob-carpenter

Summary:

From @bgoodri on http://discourse.mc-stan.org/t/numerical-error-tanks-stepsize-other-possibilities/293/3

For the complete Gamma function, I was thinking the other day that Stan could do better. It is known

https://www.vttoth.com/CMS/projects/41-the-lanczos-approximation1

how to get arbitrary precision for the log-Gamma function, which Boost basically already implements (with some additional edge cases). But in the Stan Math Library, we naively call the digamma function (in doubles) to compute the derivative, which can be less accurate. So, we could try differentiating the Lanczos / Godfrey approximation directly, which is not difficult, definitely faster, and possibly more accurate.

Current Version:

v2.14.0

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions