pyblp.build_blp_instruments

pyblp.build_blp_instruments(formulation, product_data)

Construct “sums of characteristics” excluded BLP instruments.

Traditional “sums of characteristics” BLP instruments are

(1)\[Z^\textit{BLP}(X) = [Z^\textit{BLP,Other}(X), Z^\textit{BLP,Rival}(X)],\]

in which \(X\) is a matrix of product characteristics, \(Z^\textit{BLP,Other}(X)\) is a second matrix that consists of sums over characteristics of non-rival goods, and \(Z^\textit{BLP,Rival}(X)\) is a third matrix that consists of sums over rival goods. All three matrices have the same dimensions.

Note

To construct simpler, firm-agnostic instruments that are sums over characteristics of other goods, specify a constant column of firm IDs and keep only the first half of the instrument columns.

Let \(x_{jt}\) be the vector of characteristics in \(X\) for product \(j\) in market \(t\), which is produced by firm \(f\). That is, \(j \in \mathscr{J}_{ft}\). Then,

(2)\[\begin{split}Z_{jt}^\textit{BLP,Other}(X) = \sum_{k \in \mathscr{J}_{ft} \setminus \{j\}} x_{kt}, \\ Z_{jt}^\textit{BLP,Rival}(X) = \sum_{k \notin \mathscr{J}_{ft}} x_{kt}.\end{split}\]

Note

Usually, any supply or demand shifters are added to these excluded instruments, depending on whether they are meant to be used for demand- or supply-side estimation.

Parameters
  • formulation (Formulation) – Formulation configuration for \(X\), the matrix of product characteristics used to build excluded instruments. Variable names should correspond to fields in product_data.

  • product_data (structured array-like) –

    Each row corresponds to a product. Markets can have differing numbers of products. The following fields are required:

    • market_ids : (object) - IDs that associate products with markets.

    • firm_ids : (object) - IDs that associate products with firms.

    Along with market_ids and firm_ids, the names of any additional fields can be used as variables in formulation.

Returns

Traditional “sums of characteristics” BLP instruments, \(Z^\textit{BLP}(X)\).

Return type

ndarray

Examples