MaxDiffMixedLogit.score_new_items#

MaxDiffMixedLogit.score_new_items(new_item_attributes)[source]#

Compute posterior share-of-preference after introducing new items.

Part-worths mode only. Each row of new_item_attributes is a hypothetical SKU not seen during training. The fitted patsy formula is applied via transform_attributes() to obtain design vectors for the new items; utilities follow from the posterior of beta_feat. The share-of-preference is computed over the extended pool (training items first, new items appended).

This is the Type 2 intervention (market-structure change — adding new items to the competitive set).

Parameters:
new_item_attributespd.DataFrame

One row per new item, indexed by a unique item name, with the same attribute columns as the training item_attributes. Item names must not overlap with the training pool.

Returns:
xr.Dataset

Variables u_item and share_of_preference, both of shape (chain, draw, items), where the items coordinate covers training items followed by new items. The result is also stored as self.intervention_idata.

Raises:
RuntimeError

If called on a non-part-worths model or before fitting.

ValueError

If any new item name overlaps with the training pool.