# pyblp.ProblemResults.compute_diversion_ratios¶

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

Estimate matrices of diversion ratios, $$\mathscr{D}$$, with respect to a variable, $$x$$.

In market $$t$$, the value in row $$j$$ and column $$k \neq j$$ is

(1)$\mathscr{D}_{jk} = -\frac{\partial s_{kt}}{\partial x_{jt}} \Big/ \frac{\partial s_{jt}}{\partial x_{jt}}.$

Diversion ratios for the outside good are reported on diagonals:

(2)$\mathscr{D}_{jj} = -\frac{\partial s_{0t}}{\partial x_{jt}} \Big/ \frac{\partial s_{jt}}{\partial x_{jt}}.$

Unlike ProblemResults.compute_long_run_diversion_ratios(), this gives the marginal treatment effect (MTE) version of the diversion ratio. For more information, see Conlon and Mortimer (2018).

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 diversion ratios. By default, diversion ratios are computed in all markets and stacked.

Returns

Estimated $$J_t \times J_t$$ matrices of diversion ratios, $$\mathscr{D}$$. 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