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^\text{BLP}(X) = [Z^\text{BLP,Other}(X), Z^\text{BLP,Rival}(X)],\]

in which \(X\) is a matrix of product characteristics, \(Z^\text{BLP,Other}(X)\) is a second matrix that consists of sums over characteristics of non-rival goods, and \(Z^\text{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 J_{ft}\). Then,

(2)\[\begin{split}Z_{jt}^\text{BLP,Other}(X) = \sum_{k \in J_{ft} \setminus \{j\}} x_{kt}, \\ Z_{jt}^\text{BLP,Rival}(X) = \sum_{k \notin 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^\text{BLP}(X)\).

Return type

ndarray

Examples