Beta Binomial Function in Python
I would like to calculate the probability given by a binomial distribution for predetermined x(successes), n(trials), and p(probability) - the later of which is given by a probability mass function Beta(a,b). I am aware of scipy.stats.binom.pmf(x,n,p) - but I am unsure how I can replace p with a probability function. I am also wondering whether I could use the loc argument of scipy.stats.binom.pmf to emulate this behaviour. Wiki says that the compound distribution function is given by f(k|n,a,b) = comb(n,k) * B(k+a, n-k+b) / B(a,b) where B is the beta function, a and b are the original Beta