pyblp.DiversionProbabilityMoment¶

class
pyblp.
DiversionProbabilityMoment
(product_id1, product_id2, values, market_ids=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 of agents who would choose product \(k\) if \(j\) were removed from the choice set, out of those agents whose first choice is \(j\). With the value \(\mathscr{V}_{mt}\) of this share, 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[s_{ik(j)t} s_{ijt}]}{s_{jt}}\]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
(2)¶\[g_{M,mt} = \mathscr{V}_{mt}  \frac{s_{k(j)t}  s_{kt}}{s_{jt}},\]which is more reminiscent of the longrun diversion ratios \(\bar{\mathscr{D}}_{jk}\) computed by
ProblemResults.compute_long_run_diversion_ratios()
.Integrals of these micro moments are averaged across a set \(T_m\) of markets, 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.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