0

For the data yielding the below histogram, I used gamma.fit(data) function. It yields (0.2856629839547822, 0.001612367540316285, 1.3126526078419007) which must be the alpha, loc, and scale parameters of the distribution. However, the mean and standard deviations are m=0.04181341484525036 and s=0.02581912984507876 for the given dataset. The PDF is zero below the mean (m) value. I couldn't find any questions about this problem. What am I missing?

Histogram of the data
enter image description here

Mr. T
  • 11,960
  • 10
  • 32
  • 54
  • 2
    Welcome to SO. I suggest providing [a minimal, complete, and reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – Mr. T Mar 19 '22 at 19:13
  • 1
    Could you detail your exact question a bit? Are you sure your samples come from a gamma distribution? Maybe you'd want to fix the `loc` parameter during the fit, e.g. `gamma.fit(data, floc=0)`? (Don't forget to add test data to your question.) – JohanC Mar 19 '22 at 20:50

1 Answers1

0

The PDF is most definitely not zero for all values below your calculated mean. I fact, over 40% of the PDF area resides at x<=m:

from scipy import stats

g = stats.gamma(0.2856629839547822, 0.001612367540316285, 1.3126526078419007)
m=0.04181341484525036

print(g.cdf(m))

0.4078
foglerit
  • 7,792
  • 8
  • 44
  • 64