ProblemResults.compute_optimal_instruments(method='approximate', draws=1, seed=None, expected_prices=None, iteration=None)

Estimate feasible optimal or efficient instruments, \(Z_D^\text{opt}\) and \(Z_S^\text{opt}\).

Optimal instruments have been shown, for example, by Reynaert and Verboven (2014) and Conlon and Gortmaker (2020), to reduce bias, improve efficiency, and enhance stability of BLP estimates.

Optimal instruments in the spirit of Amemiya (1977) or Chamberlain (1987) are defined by

(1)\[\begin{split}\begin{bmatrix} Z_{D,jt}^\text{opt} \\ Z_{S,jt}^\text{opt} \end{bmatrix} = \Sigma_{\xi\omega}^{-1}E\left[ \begin{matrix} \frac{\partial\xi_{jt}}{\partial\theta} \\ \frac{\partial\omega_{jt}}{\partial\theta} \end{matrix} \mathrel{\Bigg|} Z \right],\end{split}\]

in which \(Z\) are all exogenous variables.

Feasible optimal instruments are estimated by evaluating this expression at an estimated \(\hat{\theta}\). The expectation is taken by approximating an integral over the joint density of \(\xi\) and \(\omega\). For each error term realization, if not already estimated, equilibrium prices and shares are computed by iterating over the \(\zeta\)-markup contraction in (46). If marginal costs depend on prices through market shares, they will be updated to reflect different prices during each iteration of the routine.

The expected Jacobians are estimated with the average over all computed Jacobian realizations. The \(2 \times 2\) normalizing matrix \(\Sigma_{\xi\omega}\) is estimated with the sample covariance matrix of the error terms.

Optimal instruments for linear parameters not included in \(\theta\) are simple product characteristics, so they are not computed here but are rather included in the final set of instruments by OptimalInstrumentResults.to_problem().


When both a supply and demand side are estimated, there are usually collinear rows in (1) because of overlapping product characteristics in \(X_1\) and \(X_3\). The expression can be corrected by multiplying it with a conformable matrix of ones and zeros that remove the collinearity problem. The question of which rows to exclude is addressed in OptimalInstrumentResults.to_problem().

  • method (str, optional) –

    The method by which the integral over the joint density of \(\xi\) and \(\omega\) is approximated. The following methods are supported:

    • 'approximate' (default) - Evaluate the Jacobians at the expected value of the error terms: zero (draws will be ignored).

    • 'normal' - Draw from the normal approximation to the joint distribution of the error terms and take the average over the computed Jacobians (draws determines the number of draws).

    • 'empirical' - Draw with replacement from the empirical joint distribution of the error terms and take the average over the computed Jacobians (draws determines the number of draws).

  • draws (int, optional) – The number of draws that will be taken from the joint distribution of the error terms. This is ignored if method is 'approximate'. Because the default method is 'approximate', the default number of draws is 1, even though it will be ignored. For 'normal' or empirical, larger numbers such as 100 or 1000 are recommended.

  • 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.

  • expected_prices (array-like, optional) – Vector of expected prices conditional on all exogenous variables, \(E[p \mid Z]\). By default, if a supply side was estimated and shares did not enter into the formulation for \(X_3\) in Problem, iteration is used. Otherwise, this is by default estimated with the fitted values from a reduced form regression of endogenous prices onto \(Z_D\).

  • iteration (Iteration, optional) – Iteration configuration used to estimate expected prices by iterating over the \(\zeta\)-markup contraction in (46). 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 expected_prices is specified.


Computed OptimalInstrumentResults.

Return type