pyblp.ProblemResults.compute_optimal_instruments¶

ProblemResults.
compute_optimal_instruments
(method='approximate', draws=1, seed=None, expected_prices=None, iteration=None)¶ Estimate feasible optimal or efficient instruments, \(Z_D^\textit{Opt}\) and \(Z_S^\textit{Opt}\).
Optimal instruments have been shown, for example, by Reynaert and Verboven (2014) and Conlon and Gortmaker (2019), 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}^\textit{Opt} \\ Z_{S,jt}^\textit{Opt} \end{bmatrix} = \text{Var}(\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 (42).
The expected Jacobians are estimated with the average over all computed Jacobian realizations. The \(2 \times 2\) normalizing matrix \(\text{Var}(\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()
.Note
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()
. Parameters
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 defaultmethod
is'approximate'
, the default number of draws is1
, even though it will be ignored. For'normal'
or empirical, larger numbers such as100
or1000
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 (arraylike, optional) – Vector of expected prices conditional on all exogenous variables, \(E[p \mid Z]\). By default, if a supply side was estimated,
iteration
is used. If only a demand side was estimated, 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 (42). 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 ifexpected_prices
is specified.
 Returns
Computed
OptimalInstrumentResults
. Return type
OptimalInstrumentResults
Examples