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=0 means demand is uniformly spread across consumer types; G \to 1 means one type carries almost all the demand.

Parameters:
modelBayesianBLP

A fitted model.

n_samplesint

Number of posterior draws.

Returns:
np.ndarray

Shape (n_samples, M). Per-sample Gini per market.