You are viewing a single comment's thread. Return to all comments →
from math import factorial as fact
def permutation(n, r): return fact(n)/(fact(n-r))
def combination(n, r): return permutation(n,r)/fact(r)
def binomial_dist(n, x, p):
q = 1-p
return combination(n, x)*(p**x)(q*(n-x))
you do the rest. :)
Seems like cookies are disabled on this browser, please enable them to open this website
Binomial Distribution #3
You are viewing a single comment's thread. Return to all comments →
from math import factorial as fact
Permutation
def permutation(n, r): return fact(n)/(fact(n-r))
Combinations
def combination(n, r): return permutation(n,r)/fact(r)
BINOMIAL DISTRIBUTION
def binomial_dist(n, x, p):
q = 1-p
return combination(n, x)*(p**x)(q*(n-x))
you do the rest. :)