pyblp.DemographicExpectationMoment¶

class
pyblp.
DemographicExpectationMoment
(product_id, demographics_index, values, market_ids=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 of a demographic such as income, \(y_{it}\), for agents who choose product \(j\). With the value \(\mathscr{V}_{mt}\) of this mean, a micro moment \(m\) in market \(t\) can be defined by \(g_{M,mt} = \mathscr{V}_{mt}  v_{mt}\) where
(1)¶\[v_{mt} = \frac{E[y_{it}s_{ijt}]}{s_{jt}}.\]Integrals of these micro moments are averaged across a set \(T_m\) of markets, which gives \(\bar{g}_{M,m}\) in (34).
 Parameters
product_id (object) – ID of the product \(j\) or
None
to denote the outside option \(j = 0\). If notNone
, there must be exactly one of this ID 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.
values (float) – Values \(\mathscr{V}_{mt}\) of the statistic estimated from micro data. If a scalar is specified, then \(\mathscr{V}_{mt} = \mathscr{V}_m\) is assumed to be constant across all markets in which the moment is relevant. Otherwise, this should have as many elements as
market_ids
, or as the total number of markets ifmarket_ids
isNone
.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.
Examples
Methods