pyblp.ProblemResults.compute_consumer_surpluses¶

ProblemResults.
compute_consumer_surpluses
(prices=None, market_id=None)¶ Estimate populationnormalized consumer surpluses, \(\text{CS}\).
Assuming away nonlinear income effects, the surplus in market \(t\) is
(1)¶\[\text{CS} = \sum_{i=1}^{I_t} w_{it}\text{CS}_{it},\]in which the consumer surplus for individual \(i\) is
(2)¶\[\text{CS}_{it} = \log\left(1 + \sum_{j=1}^{J_t} \exp V_{jti}\right) \Big/ \left(\frac{\partial V_{1ti}}{\partial p_{1t}}\right),\]or with nesting parameters,
(3)¶\[\text{CS}_{it} = \log\left(1 + \sum_{h=1}^H \exp V_{hti}\right) \Big/ \left(\frac{\partial V_{1ti}}{\partial p_{1t}}\right)\]where \(V_{jti}\) is defined in (1) and \(V_{hti}\) is defined in (38).
Warning
\(\frac{\partial V_{1ti}}{\partial p_{1t}}\) is the derivative of utility for the first product with respect to its price. The first product is chosen arbitrarily because this method assumes that there are no nonlinear income effects, which implies that this derivative is the same for all products. Computed consumer surpluses will likely be incorrect if prices are formulated in a nonlinear fashion like
log(prices)
. Parameters
prices (arraylike, optional) – Prices at which utilities and price derivatives will be evaluated, such as equilibrium prices, \(p^*\), computed by
ProblemResults.compute_prices()
. By default, unchanged prices are used.market_id (object, optional) – ID of the market in which to compute consumer surplus. By default, consumer surpluses are computed in all markets and stacked.
 Returns
Estimated populationnormalized consumer surpluses, \(\text{CS}\). If
market_ids
was not specified, rows are in the same order asProblem.unique_market_ids
. Return type
ndarray
Examples