pyblp.CharacteristicExpectationMoment¶

class
pyblp.
CharacteristicExpectationMoment
(agent_ids, X2_index, value, observations, market_ids=None, market_weights=None)¶ Configuration for micro moments that match expectations of characteristics of products chosen by certain agents.
For example, micro data can sometimes be used to compute the mean \(\mathscr{V}_m\) of a product characteristic \(x_{jt}\) of an agent’s choice \(j\) for agents in some set \(I\). Its simulated analogue \(v_{mt}\) can be defined by
(1)¶\[v_{mt} = \sum_{i \in I} \frac{w_{it}}{w_{It}} \frac{\sum_{j \in J_t} s_{ijt}}{\sum_{j \in J_t} s_{jt}}\]where the fraction of agents in \(I\) is \(w_{It} = \sum_{i \in I} w_{it}\) and 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
agent_ids (sequence of object) – IDs of the agents \(i \in I\). At least one of these IDs should show up in the
agent_ids
field ofagent_data
inProblem
orSimulation
for each market over which this micro moment will be averaged.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.
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