pyblp.DiversionProbabilityMoment¶

class
pyblp.
DiversionProbabilityMoment
(product_id1, product_id2, value, observations, market_ids=None, market_weights=None)¶ Configuration for micro moments that match second choice probabilities of certain products for agents whose first choices are certain other products.
For example, micro data can sometimes be used to compute the share \(\mathscr{V}_m\) of agents who would choose product \(k\) if \(j\) were removed from the choice set, out of those agents whose first choice is \(j\). Its simulated analogue \(v_{mt}\) can be defined by
(1)¶\[v_{mt} = \sum_{i \in I_t} w_{it} \frac{s_{ijt}}{s_{jt}} s_{ik(j)t}\]where \(s_{ik(j)t} = s_{ijt} / (1  s_{ijt})\) is the probability of \(i\) choosing \(k\) when \(j\) is removed from the choice set. Rearranging terms gives the equivalent definition, as a longrun diversion ratio computed by
ProblemResults.compute_long_run_diversion_ratios()
:(2)¶\[v_{mt} = \frac{s_{k(j)t}  s_{kt}}{s_{jt}}.\]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_id1 (object) – ID of the first choice product \(j\) or
None
to denote the outside option \(j = 0\). 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.product_id2 (object) – ID of the second choice product \(k\) or
None
to denote the outside option \(j = 0\). If notNone
, there must be exactly one of this ID for each market over which this micro moment will be averaged.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