# Inverse of Gamma Distribution [closed]

I am using python to calculate Inverse of a CDF of gamma distribution (using scipy. stat.gamma.fit). But for probability value 1, it is coming infinite. If it is replaced from 1 to 0.99 it works but the values changes with the different number of significant figures. Like it is 61 for 0.99 and 130 for 0.9999.

I do not know the best way to handle these infinite values in my workflow.I need to get a ideals but valid inverse value for probabilities arbitrarily close to 1. But i don't know, how to decide how many digits are needed to round off the probability value. Also, I am not sure about, Will it be fine to round off?

Can we do something to get some meaningful information instead of inf value?

## closed as unclear what you're asking by Michael Chernick, kjetil b halvorsen, Peter Flom♦Feb 13 at 10:39

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• That sounds about right. Why do you think there is a “situation” here? – The Laconic Feb 13 at 5:50
• I need to get the best possible inverse value near to 1. But i don't know, how to decide the upto which digit it is needed to round off the probability value. Also, I am not sure about, Will it be fine to round off? – user10423946 Feb 13 at 7:17
• What does "best possible inverse value near to 1" mean? How near? – Peter Flom Feb 13 at 10:39
• The correct value of the inverse CDF of all Gamma distributions at the argument $1$ is $+\infty.$ It sounds like your software is giving you the right answer. – whuber Feb 13 at 14:38
• yes..that is correct but @ReeBt well explained my problem – user10423946 Feb 13 at 15:31

Probability of 1 for an event means it will occur at every single possible instance. This means that in an infinite population an infinite number of events will occur. As @thelaconic suggests this is exactly what we expect.

I am guessing you need a solution that allows the algorithms to continue to provide meaningful results when applied. The best generic best solution is to detect inf (and >N) results and get your algorithm to insert N (number of instances) in the place of inf. That will allow you to apply the abstract inverse cdf to the actual dataset.

• yes you are right.... i am looking for that only – user10423946 Feb 13 at 15:27
• In that case, if the answer has resolved your question please accept this as the answer or if not then indicate what further issues need addressed. Cheers. – ReneBt Feb 14 at 9:21