コード例 #1
0
 def __init__(self, r, p):
     DiscreteDistribution.__init__(self, lambda k: Combinatorics.c(k - 1, r - 1) * p ** r * (1 - p) ** (k - r), r / p, r * (1 - p) / (p ** 2))
     self.r = r
     self.p = p
     self.q = 1 - p
コード例 #2
0
 def __init__(self, N, M, n):
     DiscreteDistribution.__init__(self, lambda k: Combinatorics.c(M, k) * Combinatorics.c(N - M, n - k) / Combinatorics.c(N, n), n * M / N, n * M * (N - M) * (N - n) / (N ** 2 * (N - 1)))
     self.N = N
     self.M = M
     self.n = n
コード例 #3
0
 def __init__(self, n, p):
     DiscreteDistribution.__init__(self, lambda k: Combinatorics.c(n, k) * p ** k * (1 - p) ** (n - k), n * p, n * p * (1 - p))
     self.n = n
     self.p = p
     self.q = 1 - p