bayesplain.core.dirichlet_multinomial.posterior_cell_draws

bayesplain.core.dirichlet_multinomial.posterior_cell_draws(table, concentration=1.0, size=100000, rng=None)[source]

Draw whole tables of cell probabilities from the Dirichlet posterior.

With a Dirichlet(a) prior over the full set of cells, the posterior is Dirichlet(a + counts) – conjugate, so again just adding counts to concentration parameters. Each draw is a complete table of probabilities summing to one, so any quantity computed from a table can be computed once per draw to get its posterior distribution.

Parameters:
table : array_like

Table of counts, shape (R, C).

concentration : float or array_like, default 1.0

Dirichlet concentration, scalar or one value per column.

size : int, default 100_000

Number of tables to draw.

rng : numpy.random.Generator, optional

Random generator.

Returns:

Array of shape (size, R, C), each slice a table of probabilities summing to 1.

Return type:

ndarray