bayesplain.core.beta_binomial.draws

bayesplain.core.beta_binomial.draws(successes, n, a=1.0, b=1.0, size=100000, rng=None)[source]

Draw independent samples from the exact Beta posterior.

These are i.i.d. draws from a distribution known in closed form – the same operation as rolling a die, not a Markov chain. There is nothing to check for convergence and no burn-in to discard.

Parameters:
successes : int

Number of successes observed.

n : int

Number of trials.

a : float, default 1.0

Shape parameters of the Beta prior.

b : float, default 1.0

Shape parameters of the Beta prior.

size : int, default 100_000

Number of draws.

rng : numpy.random.Generator, optional

Random generator. Supply one for reproducibility.

Returns:

Array of size draws from the posterior.

Return type:

ndarray