pyblp.OptimalInstrumentResults.to_problem¶

OptimalInstrumentResults.
to_problem
(supply_shifter_formulation=None, demand_shifter_formulation=None, product_data=None)¶ Recreate the problem with estimated feasible optimal instruments.
The recreated problem will be exactly the same, except that instruments will be replaced with estimated feasible optimal instruments.
Note
Most of the explanation here is only important if a supply side was estimated.
The optimal excluded demandside instruments consist of the following:
Estimated optimal demandside instruments for \(\theta\), \(Z_D^\text{opt}\), excluding columns of instruments for any parameters on exogenous linear characteristics that were not concentrated out, but rather included in \(\theta\) by
Problem.solve()
.Optimal instruments for any linear demandside parameters on endogenous product characteristics, \(\alpha\), which were concentrated out and hence not included in \(\theta\). These optimal instruments are simply an integral of the endogenous product characteristics, \(X_1^\text{en}\), over the joint density of \(\xi\) and \(\omega\). It is only possible to concentrate out \(\alpha\) when there isn’t a supply side, so the approximation of these optimal instruments is simply \(X_1^\text{en}\) evaluated at the constant vector of expected prices, \(E[p \mid Z]\), specified in
ProblemResults.compute_optimal_instruments()
.If a supply side was estimated, any supply shifters, which are by default formulated by
OptimalInstrumentResults.supply_shifter_formulation
: all characteristics in \(X_3^\text{ex}\) not in \(X_1^\text{ex}\).
Similarly, if a supply side was estimated, the optimal excluded supplyside instruments consist of the following:
Estimated optimal supplyside instruments for \(\theta\), \(Z_S^\text{opt}\), excluding columns of instruments for any parameters on exogenous linear characteristics that were not concentrated out, but rather included in \(\theta\) by
Problem.solve()
.Optimal instruments for any linear supplyside parameters on endogenous product characteristics, \(\gamma^\text{en}\), which were concentrated out an hence not included in \(\theta\). This is only relevant if
shares
were included in the formulation for \(X_3\) inProblem
. The corresponding optimal instruments are simply an integral of the endogenous product characteristics, \(X_3^\text{en}\), over the joint density of \(\xi\) and \(\omega\). The approximation of these optimal instruments is simply \(X_3^\text{en}\) evaluated at the market shares that arise under the constant vector of expected prices, \(E[p \mid Z]\), specified inProblemResults.compute_optimal_instruments()
.
If a supply side was estimated, any demand shifters, which are by default formulated by
OptimalInstrumentResults.demand_shifter_formulation
: all characteristics in \(X_1^\text{ex}\) not in \(X_3^\text{ex}\).
As usual, the excluded demandside instruments will be supplemented with \(X_1^\text{ex}\) and the excluded supplyside instruments will be supplemented with \(X_3^\text{ex}\). The same fixed effects configured in
Problem
will be absorbed.Warning
If a supply side was estimated, the addition of supply and demandshifters may create collinearity issues. Make sure to check that shifters and other product characteristics are not collinear.
 Parameters
supply_shifter_formulation (Formulation, optional) –
Formulation
configuration for supply shifters to be included in the set of optimal demandside instruments. This is only used if a supply side was estimated. Intercepts will be ignored. By default,OptimalInstrumentResults.supply_shifter_formulation
is used.demand_shifter_formulation (Formulation, optional) –
Formulation
configuration for demand shifters to be included in the set of optimal supplyside instruments. This is only used if a supply side was estimated. Intercepts will be ignored. By default,OptimalInstrumentResults.demand_shifter_formulation
is used.product_data (structured arraylike) – Product data used instead of what was saved from
product_data
when initializing the originalProblem
. This may need to be specified if either the supply or demand shifter formulation contains some term that was not stored into memory, such as a categorical variable or a mathematical expression.
 Returns
OptimalInstrumentProblem
, which is aProblem
updated to use the estimated optimal instruments. Return type
OptimalInstrumentProblem
Examples