Skip to contents

pmf (log-space above n = 1000, matching the Python arm), mean np, second moment p^2 n(n-1) + pn, variance npq, and the p = 1/(n+1) solving P(0) = P(1). Mirrors morie.fn ch4 binomial modules.

Usage

morie_binomial_dist(n, p, k = NULL)

Arguments

n, p

trial count and success probability.

k

optional specific count.

Value

list: pmf (if k given), mean, second_moment, variance, p_zero_equals_one.

References

Morin (2016), eqs. (4.6)-(4.10), (4.61), (4.66)-(4.67).

Examples

morie_binomial_dist(4, 0.5, k = 2)$pmf
#> [1] 0.375