BayesianBLP.batch_shares#

BayesianBLP.batch_shares(alpha_M, beta_M, xi_M, sigma_M, price)[source]#

Numpy-evaluate the share equation for a batch of posterior samples.

Vectorised across the leading sample axis S. When the requested allocation exceeds _SHARES_CHUNK_BYTES (2 GiB by default), the sample axis is split into chunks; results are concatenated. A UserWarning fires on the first chunk to surface the cap.

Parameters:
alpha_Mnp.ndarray

Shape (S, M). Per-sample, per-market price coefficient.

beta_Mnp.ndarray

Shape (S, M, K). Per-sample, per-market characteristic weights.

xi_Mnp.ndarray

Shape (S, M, J). Per-sample latent product-market shocks.

sigma_Mnp.ndarray or None

Shape (S, n_random) when random coefficients are present; otherwise pass None.

pricenp.ndarray

Shape (M, J). Per-market inside-good prices.

Returns:
s_inside_per_drawnp.ndarray

Shape (S, M, J, R). Per-consumer-draw inside-good probabilities.

s_inside_aggnp.ndarray

Shape (S, M, J). Halton-averaged inside-good shares.

s_outside_per_drawnp.ndarray

Shape (S, M, R). Per-consumer-draw outside-good probabilities.

s_outside_aggnp.ndarray

Shape (S, M). Halton-averaged outside-good shares.

alpha_per_drawnp.ndarray

Shape (S, M, R). Per-consumer-draw price coefficient (alpha plus the per-draw price taste shock when price is a random coefficient).