pyblp.DemographicInteractionMoment¶

class
pyblp.
DemographicInteractionMoment
(X2_index, demographics_index, value, observations, market_ids=None, market_weights=None)¶ Configuration for micro moments that match expectations of interactions between product characteristics and demographics.
For example, micro data can sometimes be used to compute the mean \(\mathscr{V}_m\) of \(x_{jt} y_{it}\) where \(x_{jt}\) is a product characteristic of an agent’s choice \(j\) and \(y_{it}\) is a demographic of the agent such as income, amongst those agents who purchase an inside good. Its simulated analogue \(v_{mt}\) can be defined by
(1)¶\[v_{mt} = \sum_{i \in I_t} w_{it} \frac{1  s_{i0t}}{1  s_{0t}} z_{it} y_{it}\]where conditional on choosing an inside good, the expected value of \(x_{jt}\) for agent \(i\) is
(2)¶\[z_{it} = \sum_{j \in J_t} x_{jt} s_{ij(0)t}\]where \(s_{ij(0)t} = s_{ijt} / (1  s_{i0t})\) is the probability of \(i\) choosing \(j\) when the outside option is 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_index (int) – Column index of \(x_{jt}\) in the matrix of demandside nonlinear product characteristics, \(X_2\). This should be between zero and \(K_2  1\), inclusive.
demographics_index (int) – Column index of the demographic \(y_{it}\) (which can be any demographic, not just income) in the matrix of agent demographics, \(d\). This should be between zero and \(D  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 (arraylike, 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 (arraylike, optional) – Weights for averaging micro moments over specified
market_ids
. By default, these are \(1 / T_m\).
Examples
Methods