demand_concentration_gini#
- pymc_marketing.customer_choice.taste_profiles.demand_concentration_gini(model, n_samples=300)[source]#
Per-sample Gini of inside-good demand across consumer types, per market.
For each (sample, market) the contributions are \(s^{\mathrm{in}}_{m,r}\) summed across products. The Gini coefficient is computed via the sorted-and-weighted formula
\[G = \frac{\sum_r (2r - R - 1)\, x_{(r)}}{R \sum_r x_{(r)}}\]where \(x_{(r)}\) are the sorted contributions ascending.
G=0means demand is uniformly spread across consumer types;G \to 1means one type carries almost all the demand.- Parameters:
- model
BayesianBLP A fitted model.
- n_samples
int Number of posterior draws.
- model
- Returns:
np.ndarrayShape
(n_samples, M). Per-sample Gini per market.