pyblp.DemographicExpectationMoment¶

class
pyblp.
DemographicExpectationMoment
(product_ids, demographics_index, value, observations, market_ids=None, market_weights=None)¶ Configuration for micro moments that match expectations of demographics for agents who choose certain products.
For example, micro data can sometimes be used to compute the mean \(\mathscr{V}_m\) of a demographic such as income, \(y_{it}\), for agents who choose products in some set \(J\). Its simulated analogue \(v_{mt}\) can be defined by
(1)¶\[v_{mt} = \sum_{i \in I_t} w_{it} \frac{\sum_{j \in J} s_{ijt}}{\sum_{j \in J} s_{jt}} y_{it}.\]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
product_ids (sequence of object) – IDs of the products \(j \in J\), which may include
None
to denote the outside option \(j = 0\). If there is noNone
, at least one of these IDs should show up in theproduct_ids
field ofproduct_data
inProblem
orSimulation
for each market over which this micro moment will be averaged.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