BayesianBLP.iterate_posterior_samples#

BayesianBLP.iterate_posterior_samples(n_samples)[source]#

Stack chain × draw and (optionally) subsample posterior arrays.

Resolves region-level parameters at each market via the model’s regionmarket index, so downstream code sees per-market arrays without having to re-broadcast.

Parameters:
n_samplesint or None

If given and smaller than the available chain × draw total, randomly subsample to n_samples posterior draws using the model’s random_seed so results are reproducible.

Returns:
alpha_at_marketnp.ndarray

Shape (S, M).

beta_at_marketnp.ndarray

Shape (S, M, K).

xinp.ndarray

Shape (S, M, J).

sigma_randomnp.ndarray or None

Shape (S, n_random) when the model has random coefficients; None otherwise.

Raises:
RuntimeError

If the model has not been fitted.