2

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?

Ellen
  • 85
  • 4

1 Answers1

5

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
MB-F
  • 22,770
  • 4
  • 61
  • 116