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 nonrival 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, firmagnostic 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 supplyside estimation.
 Parameters
formulation (Formulation) –
Formulation
configuration for \(X\), the matrix of product characteristics used to build excluded instruments. Variable names should correspond to fields inproduct_data
.product_data (structured arraylike) –
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
andfirm_ids
, the names of any additional fields can be used as variables informulation
.
 Returns
Traditional “sums of characteristics” BLP instruments, \(Z^\textit{BLP}(X)\).
 Return type
ndarray
Examples