stats for invgamma (Trac #1340) #1866

scipy-gitbot opened this Issue Apr 25, 2013 · 4 comments


None yet

4 participants


Original ticket on 2010-12-04 by @josef-pkt, assigned to unknown.

invgamma does not contain _stats, and no information that the moments might only exist or be finite if alpha is large enough.

From the wikipedia description
it looks relatively easy to add explicit formulas for _stats().

parameterization alpha is a, beta is scale

incorrect skew at a=2.99 (skew requires a>3 )

>>> stats.invgamma.stats(2.99, moments='mvsk')
(array(0.50251256281407031), array(0.2550695715009747), array(390.05497509454568), array(-789.86454653467047))
>>> stats.invgamma.stats(3., moments='mvsk')
(array(0.5), array(0.25), array(1.#INF), array(-1.#IND))
>>> stats.invgamma.stats(3.1, moments='mvsk')
(array(0.47619047619047616), array(0.20614306328592044), array(41.952353926806026), array(-73.619999999999919))

incorrect variance at a=1.99 (variance requires a > 2)

>>> stats.invgamma.stats(1.99, moments='mvsk')
(array(1.0101010101010102), array(99.989796959493844), array(-0.20405122222445857), array(-2.9739028311131137))
>>> stats.invgamma.stats(2., moments='mvsk')
(array(1.0), array(1.#INF), array(-1.#IND), array(-1.#IND))
>>> stats.invgamma.stats(2.1, moments='mvsk')
(array(0.90909090909090906), array(8.2644628099173456), array(-0.55515541145178238), array(-2.8299415204678362))

Milestone changed to Unscheduled by @rgommers on 2011-06-12

ev-br commented Sep 9, 2013

Ha been fixed in #2841.

pv commented Sep 9, 2013

Fixed then.

@pv pv closed this Sep 9, 2013
@pv pv reopened this Sep 10, 2013

Fixed by gh-2849. Thanks @EvgeniBurovski

@rgommers rgommers closed this Sep 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment