Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify gamma distribution using shape and rate in Python?

With Scipy gamma distribution, one can only specify shape, loc, and scale. How do I create a gamma variable with shape and rate?

like image 438
Heisenberg Avatar asked Mar 17 '23 06:03

Heisenberg


1 Answers

Inverse scale (1/scale) is rate parameter.

So if you have shape and rate you can create gamma rv with this code

>>> from scipy.stats import gamma
>>> rv = gamma(shape, scale = 1.0/rate)

Read more about different parametrizations of Gamma distribution on Wikipedia: http://en.wikipedia.org/wiki/Gamma_distribution

like image 95
Alik Avatar answered Mar 18 '23 19:03

Alik