# pyblp.ProblemResults.compute_consumer_surpluses¶

ProblemResults.compute_consumer_surpluses(prices=None)

Estimate population-normalized consumer surpluses, $$\text{CS}$$.

Assuming away nonlinear income effects, the surplus in market $$t$$ is

(1)$\text{CS} = \sum_{i=1}^{I_t} w_i\text{CS}_i,$

in which the consumer surplus for individual $$i$$ is

(2)$\text{CS}_i = \log\left(1 + \sum_{j=1}^{J_t} \exp V_{jti}\right) \Big/ \frac{\partial V_{1ti}}{\partial p_{1t}},$

or with nesting parameters,

(3)$\text{CS}_i = \log\left(1 + \sum_{h=1}^H \exp V_{hti}\right) \Big/ \frac{\partial V_{1ti}}{\partial p_{1t}}$

where $$V_{jti}$$ is defined in (1) and $$V_{hti}$$ is defined in (34).

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 (array-like, 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.

Returns

Estimated population-normalized consumer surpluses, $$\text{CS}$$, for all markets. Rows are in the same order as Problem.unique_market_ids.

Return type

ndarray

Examples