Friday, October 7, 2022

[FIXED] Why does the Gamma distribution in SciPy have three parameters?

Issue

Usually, the Gamma distribution has two parameters: shape and scale (or alternatively shape and rate). However, it seems that in SciPy the Gamma distribution has three parameters: two shape parameters and a location parameter.

Does anyone know the mapping between the SciPy parameters of Gamma, and, e.g., the parameters in the definition given on wikipedia:

http://en.wikipedia.org/wiki/Gamma_distribution

Thanks!


Solution

All the continuous distributions in scipy.stats have location and scale parameters, even those for which the location is not generally used. For the gamma distribution, just leave the location at its default value 0. If you are using the fit method, use the argument floc=0 to ensure that it does not treat the location as a free parameter.

The shape and scale parameters in the scipy gamma distribution correspond to k and θ, respectively, in the wikipedia page.



Answered By - Warren Weckesser
Answer Checked By - Katrina (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.