I'm working through the Coursera course Bayesian Statistics: From Concept to Data Analysis by the University of California, Santa Cruz and there is a worksheet that requires me to use R or Excel to find the answer to this:
Let $Y ∼ Gamma(2, 1/3)$. Find $P(0.5 < Y < 1.5)$. The answer is given as 0.078.
I would like to calculate this using Python. I have tried
from scipy import stats
stats.gamma.cdf(1.5,1/3,scale=2) - stats.gamma.cdf(0.5,1/3,scale=2)
which returns 0.197. I've also tried switching the 2 and the 1/3.
Note I am using
Python 3.5.3 |Anaconda 2.5.0 (64-bit)| (default, May 15 2017, 10:43:23) [MSC v.1900 64 bit (AMD64)] on win32
What am I doing wrong?
stats.gamma.cdf(1.5,2,scale=3) - stats.gamma.cdf(0.5,2,scale=3)– Dan Jun 08 '17 at 01:08