pyblp.DiversionInteractionMoment

class pyblp.DiversionInteractionMoment(X2_index1, X2_index2, value, observations, market_ids=None, market_weights=None)

Configuration for micro moments that match expectations of interactions between product characteristics of first and second choices.

For example, survey data can sometimes be used to compute the mean \(\mathscr{V}_m\) of \(x_{jt}^{(1)} x_{kt}^{(2)}\) where \(x_{jt}^{(1)}\) is a product characteristic of an agent’s first choice \(j\) and \(x_{kt}^{(2)}\) is either the same or a different product characteristic of the agent’s second choice \(k\) if \(j\) were removed from the choice set, amongst those agents whose first and second choices are both inside goods. Its simulated analogue \(v_{mt}\) can be defined by

(1)\[v_{mt} = \sum_{i \in I_t} w_{it} \frac{s_{iJJ}}{s_{JJ}} z_{it}^{(1)} z_{it}^{(2)}\]

where the probability agent \(i\) chooses inside goods and the corresponding share are

(2)\[s_{iJJ} = \sum_{j, k \in J_t} s_{ijt} s_{ik(-j)t}, \quad s_{JJ} = \sum_{i \in I_t} w_{it} s_{iJJ},\]

and where conditional on purchasing inside goods, the expected values of \(x_{jt}^{(1)}\) and \(x_{kt}^{(2)}\) for agent \(i\) are

(3)\[z_{it}^{(1)} = \sum_{j \in J_t} x_{jt}^{(1)} s_{ij(-0)t}, \quad z_{it}^{(2)} = \sum_{j, k \in J_t} x_{kt}^{(2)} s_{ij(-0)t} s_{ik(-0,j)t},\]

in which \(s_{ij(-0)t}\) is the probability of choosing \(j\) when the outside option is removed from the choice set and \(s_{ik(-0,j)t}\) is the probability of choosing \(k\) when both the outside option and \(j\) are removed from the choice set.

These are averaged across a set of markets \(T_m\) and compared with \(\mathscr{V}_m\), which gives \(\bar{g}_{M,m}\) in (34).

Parameters
  • X2_index1 (int) – Column index of \(x_{jt}^{(1)}\) in the matrix of demand-side nonlinear product characteristics, \(X_2\). This should be between zero and \(K_2 - 1\), inclusive.

  • X2_index2 (int) – Column index of \(x_{kt}^{(2)}\) in the matrix of demand-side nonlinear product characteristics, \(X_2\). This should be between zero and \(K_2 - 1\), inclusive.

  • value (float) – Value \(\mathscr{V}_m\) of the statistic estimated from micro data.

  • observations (int) – Number of micro data observations \(N_m\) used to estimate \(\mathscr{V}_m\), which is used to properly scale micro moment covariances in (35).

  • market_ids (array-like, optional) – Distinct market IDs over which the micro moments will be averaged to get \(\bar{g}_{M,m}\). These are also the only markets in which the moments will be computed. By default, the moments are computed for and averaged across all markets.

  • market_weights (array-like, optional) – Weights for averaging micro moments over specified market_ids. By default, these are \(1 / T_m\).

Examples

Methods