# pyblp.ProblemResults.compute_diversion_ratios¶

ProblemResults.compute_diversion_ratios(name='prices')

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

Diversion ratios to the outside good are reported on diagonals. For each market, the value in row $$j$$ and column $$k$$ is

(1)$\mathscr{D}_{jk} = -\frac{\partial s_{k(j)}}{\partial x_j} \Big/ \frac{\partial s_j}{\partial x_j},$

in which $$s_{k(j)}$$ is $$s_0 = 1 - \sum_j s_j$$ if $$j = k$$, and is $$s_k$$ otherwise.

Parameters

name (str, optional) – Name of the variable, $$x$$. By default, $$x = p$$, prices.

Returns

Stacked $$J_t \times J_t$$ estimated matrices of diversion ratios, $$\mathscr{D}$$, for all markets. 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