pyblp.ProblemResults.compute_shares

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

Estimate shares.

It may be desirable to compute the shares 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 shares, and then compare error between these precisely-computed shares and shares 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 shares, 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 shares, 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 shares. 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 shares, 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 shares. By default, shares are computed in all markets and stacked.

Returns

Estimates of shares.

Return type

ndarray

Examples