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 likeProblemResults
to compute various postestimation outputs for different markets. The only difference is thatBootstrappedResults
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 postestimation outputs.For each bootstrap draw, parameters are drawn from the estimated multivariate normal distribution of all parameters defined by
ProblemResults.parameters
andProblemResults.parameter_covariances
(where the second covariance matrix is divided by \(N\)). Any bounds configured inProblem.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 (47). If marginal costs depend on prices through market shares, they will be updated to reflect different prices during each iteration of the routine.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 withdraws = 1
. In each iteration of the loop, compute the desired postestimation output with the proper method of the returnedBootstrappedResults
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 (47). By default, if a supply side was estimated, this isIteration('simple', {'atol': 1e12})
. 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