pyblp.ProblemResults.compute_elasticities

ProblemResults.compute_elasticities(name='prices', market_id=None)

Estimate matrices of elasticities of demand, \(\varepsilon\), with respect to a variable, \(x\).

In market \(t\), the value in row \(j\) and column \(k\) of \(\varepsilon\) is

(1)\[\varepsilon_{jk} = \frac{x_{kt}}{s_{jt}}\frac{\partial s_{jt}}{\partial x_{kt}}.\]
Parameters
  • name (str, optional) – Name of the variable, \(x\). By default, \(x = p\), prices. If this is None, the variable will be \(x = \delta\), the mean utility.

  • market_id (object, optional) – ID of the market in which to compute elasticities. By default, elasticities are computed in all markets and stacked.

Returns

Estimated \(J_t \times J_t\) matrices of elasticities of demand, \(\varepsilon\). If market_id was not specified, matrices are estimated in each market \(t\) and stacked. Columns for a market are in the same order as products for the market. If a market has fewer products than others, extra columns will contain numpy.nan.

Return type

ndarray

Examples