pyblp.ProblemResults.bootstrap

ProblemResults.bootstrap(draws=1000, seed=None, iteration=None)

Use a parametric bootstrap to create an empirical distribution of results.

The constructed BootstrappedResults can be used just like ProblemResults to compute various post-estimation outputs. The only difference is that BootstrappedResults methods return arrays with an extra first dimension, along which bootstrapped results are stacked. These stacked results can be used to construct, for example, confidence intervals for post-estimation outputs.

For each bootstrap draw, parameters are drawn from the estimated multivariate normal distribution of all parameters defined by ProblemResults.parameters and ProblemResults.parameter_covariances. Any bounds configured in Problem.solve() will also bound parameter draws. Each parameter draw is used to compute the implied mean utility, \(\delta\), and shares, \(s\). If a supply side was estimated, the implied marginal costs, \(c\), and prices, \(p\), are computed as well by iterating over the \(\zeta\)-markup contraction in (42).

Note

By default, parametric bootstrapping may use a lot of memory. This is because all bootstrapped results (for all draws) are stored in memory at the same time. Memory usage can be reduced by calling this method in a loop with draws = 1. In each iteration of the loop, compute the desired post-estimation output with the proper method of the returned BootstrappedResults class and store these outputs.

Parameters
  • draws (int, optional) – The number of draws that will be taken from the joint distribution of the parameters. The default value is 1000.

  • seed (int, optional) – Passed to numpy.random.RandomState to seed the random number generator before any draws are taken. By default, a seed is not passed to the random number generator.

  • iteration (Iteration, optional) – Iteration configuration used to compute bootstrapped prices by iterating over the \(\zeta\)-markup equation in (42). By default, if a supply side was estimated, this is Iteration('simple', {'atol': 1e-12}). Analytic Jacobians are not supported for solving this system. This configuration is not used if a supply side was not estimated.

Returns

Computed BootstrappedResults.

Return type

BootstrappedResults

Examples