-1

According to Wikipedia the expected value of a Gamma distribution is k * theta. However, when I plug that into the CDF for the gamma distribution I don't get 0.5 as expected.

k = 1.5
theta = 2.1
expected_value = k * theta
scipy.stats.gamma.cdf(expected_value, k, scale=theta)

The result of the last line is 0.6083 instead of 0.5 as expected.

Aaron
  • 2,354
  • 1
  • 17
  • 25

1 Answers1

3

The value of the CDF at the median is 0.5. k*theta gives the mean (i.e. the expected value), not the median.

In [8]: from scipy.stats import gamma

In [9]: k = 1.5

In [10]: theta = 2.1

In [11]: med = gamma.median(k, scale=theta)

In [12]: med
Out[12]: 2.4842725785941049

In [13]: gamma.cdf(med, k, scale=theta)
Out[13]: 0.49999999999999994
Warren Weckesser
  • 110,654
  • 19
  • 194
  • 214