pyblp.OptimalInstrumentResults.to_problem

OptimalInstrumentResults.to_problem(supply_shifter_formulation=None, demand_shifter_formulation=None, product_data=None, drop_indices=None)

Re-create the problem with estimated feasible optimal instruments.

The re-created 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 demand-side instruments consist of the following:

  1. Estimated optimal demand-side 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().

  2. Optimal instruments for any linear demand-side 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().

  3. 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 supply-side instruments consist of the following:

  1. Estimated optimal supply-side 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().

  2. Optimal instruments for any linear supply-side 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\) in Problem. 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 in ProblemResults.compute_optimal_instruments().

  1. 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 demand-side instruments will be supplemented with \(X_1^\text{ex}\) and the excluded supply-side 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 demand-shifters 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 demand-side 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 supply-side 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 array-like, optional) – Product data used instead of what was saved from product_data when initializing the original Problem. 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.

  • drop_indices (sequence of int, optional) – Which column indices to drop from OptimalInstrumentResults.demand_instruments and OptimalInstrumentResults.supply_instruments. By default, the only columns dropped are those that correspond to parameters in \(\theta\) on exogenous linear characteristics.

Returns

OptimalInstrumentProblem, which is a Problem updated to use the estimated optimal instruments.

Return type

OptimalInstrumentProblem

Examples