pyblp.Simulation.solve

Simulation.solve(firm_ids=None, ownership=None, prices=None, iteration=None, error_behavior='raise')

Compute synthetic prices and shares.

Prices and shares are computed in each market by iterating over the \(\zeta\)-markup contraction in (42):

(1)\[p \leftarrow c + \zeta(p).\]

Note

To create a simulation under perfect (instead of Bertrand) competition, use an Iteration configuration with method='return'. This will set prices equal to the default starting values for the iteration routine, which are marginal costs.

Note

This method supports parallel() processing. If multiprocessing is used, market-by-market computation of prices and shares will be distributed among the processes.

Parameters
  • firm_ids (array-like, optional) – Potentially changed firms IDs. By default, the firm_ids field of product_data in Simulation will be used.

  • ownership (array-like, optional) – Custom ownership matrices. By default, standard ownership matrices based on firm_ids will be used unless the ownership field of product_data in Simulation was specified.

  • prices (array-like, optional) – Prices at which the fixed point iteration routine will start. By default, marginal costs, \(c\), are used as starting values.

  • iteration (Iteration, optional) – Iteration configuration for how to solve the fixed point problem. By default, Iteration('simple', {'atol': 1e-12}) is used. Analytic Jacobians are not supported for solving this system.

  • error_behavior (str, optional) –

    How to handle errors when computing prices and shares. For example, the fixed point routine may not converge if the effects of nonlinear parameters on price overwhelm the linear parameter on price, which should be sufficiently negative. The following behaviors are supported:

    • 'raise' (default) - Raise an exception.

    • 'warn' - Use the last computed prices and shares. If the fixed point routine fails to converge, these are the last prices and shares computed by the routine. If there are other issues, these are the starting prices and their associated shares.

Returns

SimulationResults of the solved simulation.

Return type

SimulationResults

Examples