Draw from the posterior of a binomial proportion
Source:R/uncertainty_propagation.R
sample_binomial_proportion.RdDraws from the Jeffreys posterior Beta(x + 1/2, n - x + 1/2)
implied by observing estimate * n_replicates successes in n_replicates
replicates.
This replaces approximating an exact binomial interval by a symmetric
normal and discarding the draws that fall outside (0, 1). The posterior
is supported on (0, 1) by construction, so no draw is ever discarded, and
it retains the skewness that the normal approximation removes – which
matters most for the small type I errors these comparisons are made at.