Ellen
Ellen

Reputation: 85

How to calculate the mean of a fitted gamma distribution?

I used scipy.stats.gamma.fit(data) to fit a gamma distribution to my data. I want to know what the mean of the resulting distribution is.

How do I find the mean of the fitted gamma distribution?

Upvotes: 2

Views: 1015

Answers (1)

MB-F
MB-F

Reputation: 23637

The distributions in scipy.stats have a mean method that (unsurprisingly) computes the mean.

You take the fitted parameters returned by scipy.stats.gamma.fit and pass them to scipy.stats.gamma.mean:

data = stats.gamma.rvs(5, 2, size=1000);  # generate example data

params = scipy.stats.gamma.fit(data)
print(scipy.stats.gamma.mean(*params))
# 6.99807037952

Upvotes: 5

Related Questions