pyblp.SimulationResults¶
-
class
pyblp.
SimulationResults
¶ Results of a solved simulation of synthetic BLP data.
The
SimulationResults.to_problem()
method can be used to convert the full set of simulated data (along with some basic default instruments) and configured information into aProblem
. Additionally, this class has duplicates of the followingProblemResults
methods:-
simulation
¶ Simulation
that created these results.- Type
Simulation
-
product_data
¶ Simulated
Simulation.product_data
with product characteristics replaced so as to be consistent with the true parameters. IfSimulation.replace_endogenous()
was used to create these results, prices and market shares were replaced. IfSimulation.replace_exogenous()
was used, exogenous characteristics were replaced instead. Thedata_to_dict()
function can be used to convert this into a more usable data type.- Type
recarray
-
delta
¶ Simulated mean utility, \(\delta\).
- Type
ndarray
-
costs
¶ Simulated marginal costs, \(c\).
- Type
ndarray
-
computation_time
¶ Number of seconds it took to compute prices and market shares.
- Type
float
-
fp_converged
¶ Flags for convergence of the iteration routine used to compute prices or \(\delta\) (depending on the method used to create these results) in each market. Flags are in the same order as
Simulation.unique_market_ids
.- Type
ndarray
-
fp_iterations
¶ Number of major iterations completed by the iteration routine used to compute prices or \(\delta\) in each market. Counts are in the same order as
Simulation.unique_market_ids
.- Type
ndarray
-
contraction_evaluations
¶ Number of times the contraction used to compute prices or \(\delta\) was evaluated in each market. Counts are in the same order as
Simulation.unique_market_ids
.- Type
ndarray
-
profit_gradients
¶ Mapping from market IDs \(t\) to mappings from firm IDs \(f\) to profit gradients. This is only computed if these results were created by
Simulation.replace_endogenous()
. The profit gradient for firm \(f\) in market \(t\) is a \(J_{ft}\) vector with element \(k \in J_{ft}\)(1)¶\[\frac{\partial \pi_{ft}}{\partial p_{kt}} = \sum_{j \in J_{ft}} \frac{\partial \pi_{jt}}{\partial p_{kt}}\]where population-normalized profits are
(2)¶\[\pi_{jt} = (p_{jt} - c_{jt}) s_{jt}.\]When there is a nontrivial ownership structure, the sum is over all products \(j \in J_t\) and the terms are weighted by the firm’s (possibly partial) ownership of product \(j\), given by \(\mathscr{H}_{jk}\).
- Type
dict
-
profit_gradient_norms
¶ Mapping from market IDs \(t\) to mappings from firm IDs \(f\) to the infinity norm of profit gradients. This is only computed if these results were created by
Simulation.replace_endogenous()
. If a norm is near to zero, the firm’s choice of profits is near to a local optimum.- Type
dict
-
profit_hessians
¶ Mapping from market IDs \(t\) to mappings from firm IDs \(f\) to profit Hessians. This is only computed if these results were created by
Simulation.replace_endogenous()
. The profit Hessian for firm \(f\) in market \(t\) is a \(J_{ft} \times J_{ft}\) matrix with element \((k, \ell) \in J_{ft}^2\)(3)¶\[\frac{\partial^2 \pi_{ft}}{\partial p_{kt} \partial p_{\ell t}} = \sum_{j \in J_{ft}} \frac{\partial^2 \pi_{jt}}{\partial p_{kt} \partial p_{\ell t}}\]where population-normalized profits are
(4)¶\[\pi_{jt} = (p_{jt} - c_{jt}) s_{jt}.\]When there is a nontrivial ownership structure, the sum is over all products \(j \in J_t\) and the terms are weighted by the firm’s (possibly partial) ownership of product \(j\), given by \(\mathscr{H}_{jk}\).
- Type
dict
-
profit_hessian_eigenvalues
¶ Mapping from market IDs \(t\) to mappings from firm IDs \(f\) to the eigenvalues of profit Hessians. This is only computed if these results were created by
Simulation.replace_endogenous()
. If the fixed point converged and all eigenvalues are negative, the firm’s choice of profits is a local maximum.- Type
dict
Examples