-1

So when using excel there is a function for gamma distribution function over there, I'm doing =GAMMADIST(B2,$K$2,$K$3, TRUE) which is nothing but GAMMADIST(x, alpha, beta, cumulative), here B2 is nothing but my first value of data, K2 and K3 are my alpha and beta values. How do we do this in Python is my question?

I have

x = np.array([6150033,499568,76,85,0,3814592])
alpha = 2
beta = 3028594.65 
stats.gamma.pdf(x, a=alpha, scale=1/beta)

Expected output: 60%, 1%, 0%, 0%, 0%, 36%

I'm unable to understand how to use stats.gamma function in python and which one to use for example there are different types like rvs,pdf,logpdf,cdf... etc

stats.gamma.pdf(x, a=alpha, scale=1/beta) Is that the correct way of doing it?

Akilesh
  • 413
  • 3
  • 11

2 Answers2

0

The scipy library has the gamma function

https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.gamma.html

Gus Beringer
  • 172
  • 9
  • Ya, I have looked into that but was unable to get where to put my values and get the expected output. – Akilesh Aug 04 '21 at 05:18
0

stats.gamma.cdf(data, a=alpha, scale=beta)

I figured out that I'm doing cumulative so cdf is a cumulative function and that worked.

Akilesh
  • 413
  • 3
  • 11