{ } Raw JSON

bundles / scipy latest / scipy / stats / _continuous_distns / _digammainv

function

scipy.stats._continuous_distns:_digammainv

source: /scipy/stats/_continuous_distns.py :3508

Signature

def   _digammainv ( y )

Summary

Inverse of the digamma function (real positive arguments only).

Extended Summary

This function is used in the fit method of gamma_gen. The function uses either optimize.fsolve or optimize.newton to solve sc.digamma(x) - y = 0. There is probably room for improvement, but currently it works over a wide range of y:

>>> import numpy as np
>>> rng = np.random.default_rng()
>>> y = 64*rng.standard_normal(1000000)
>>> y.min(), y.max()
(-311.43592651416662, 351.77388222276869)
>>> x = [_digammainv(t) for t in y]
>>> np.abs(sc.digamma(x) - y).max()
1.1368683772161603e-13

Aliases

  • scipy.stats._continuous_distns._digammainv