pyblp.ProblemResults.compute_probabilities

ProblemResults.compute_probabilities(prices=None, delta=None, agent_data=None, integration=None, market_id=None)

Estimate matrices of choice probabilities.

For each market, the value in row \(j\) and column i is given by (5) when there are random coefficients, and by (43) when there is additionally a nested structure. For the logit and nested logit models, choice probabilities are market shares.

It may be desirable to compute the probabilities associated with equilibrium prices that have been computed, for example, by ProblemResults.compute_prices().

Note

To compute equilibrium shares (and prices) associated with a more complicated counterfactual, a Simulation for the counterfactual can be initialized with the estimated parameters, structural errors, and marginal costs from these results, and then solved with Simulation.replace_endogenous().

Alternatively, this method can also be used to evaluate the performance of different numerical integration configurations. One way to do so is to use ProblemResults.compute_delta() to compute mean utilities with a very precise integration rule (one that is infeasible to use during estimation), use these same mean utilities and integration rule to precisely compute probabilities, and then compare error between these precisely-computed probabilities and probabilities computed with less precise (but feasible to use during estimation) integration rules, still using the precisely-computed mean utilities.

Parameters
  • prices (array-like, optional) – Prices at which to evaluate probabilities, such as equilibrium prices, \(p^*\), computed by ProblemResults.compute_prices(). By default, unchanged prices are used.

  • delta (array-like, optional) – Mean utilities that will be used to evaluate probabilities, such as those computed more precisely by ProblemResults.compute_delta(). By default, the estimated ProblemResults.delta is used, and updated with any specified prices.

  • agent_data (structured array-like, optional) – Agent data that will be used to compute probabilities. By default, agent_data in Problem is used. For more information, refer to Problem.

  • integration (Integration, optional) – Integration configuration that will be used to compute probabilities, which will replace any nodes field in agent_data. This configuration is required if agent_data is specified without a nodes field. By default, agent_data in Problem is used. For more information, refer to Problem.

  • market_id (object, optional) – ID of the market in which to compute choice probabilities. By default, choice probabilities are computed in all markets and stacked.

Returns

Estimated \(J_t \times I_t\) matrices of choice probabilities. If market_id was not specified, matrices are estimated in each market \(t\) and stacked. Columns for a market are in the same order as agents for the market. If a market has fewer agents than others, extra columns will contain numpy.nan.

Return type

ndarray

Examples