pyblp.build_ownership(product_data, kappa_specification=None)

Build ownership matrices, \(O\).

Ownership matrices are defined by their cooperation matrix counterparts, \(\kappa\). For each market \(t\), \(O_{jk} = \kappa_{fg}\) where \(j \in \mathscr{J}_{ft}\), the set of products produced by firm \(f\) in the market, and similarly, \(g \in \mathscr{J}_{gt}\).

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

  • kappa_specification (callable, optional) –

    A function that specifies each market’s cooperation matrix, \(\kappa\). The function is of the following form:

    kappa(f, g) -> value

    where value is \(O_{jk}\) and both f and g are firm IDs from the firm_ids field of product_data.

    The default specification, lambda: f, g: int(f == g), constructs traditional ownership matrices. That is, \(\kappa = I\), the identify matrix, implies that \(O_{jk}\) is \(1\) if the same firm produces products \(j\) and \(k\), and is \(0\) otherwise.

    If firm_ids happen to be indices for an actual \(\kappa\) matrix, lambda f, g: kappa[f, g] will build ownership matrices according to the matrix kappa.


Stacked \(J_t \times J_t\) ownership matrices, \(O\), for each market \(t\). If a market has fewer products than others, extra columns will contain numpy.nan.

Return type