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. AUserWarningfires on the first chunk to surface the cap.- Parameters:
- alpha_M
np.ndarray Shape
(S, M). Per-sample, per-market price coefficient.- beta_M
np.ndarray Shape
(S, M, K). Per-sample, per-market characteristic weights.- xi_M
np.ndarray Shape
(S, M, J). Per-sample latent product-market shocks.- sigma_M
np.ndarrayorNone Shape
(S, n_random)when random coefficients are present; otherwise passNone.- price
np.ndarray Shape
(M, J). Per-market inside-good prices.
- alpha_M
- Returns:
- s_inside_per_draw
np.ndarray Shape
(S, M, J, R). Per-consumer-draw inside-good probabilities.- s_inside_agg
np.ndarray Shape
(S, M, J). Halton-averaged inside-good shares.- s_outside_per_draw
np.ndarray Shape
(S, M, R). Per-consumer-draw outside-good probabilities.- s_outside_agg
np.ndarray Shape
(S, M). Halton-averaged outside-good shares.- alpha_per_draw
np.ndarray Shape
(S, M, R). Per-consumer-draw price coefficient (alphaplus the per-draw price taste shock whenpriceis a random coefficient).
- s_inside_per_draw