NestedLogit.apply_intervention#

NestedLogit.apply_intervention(new_choice_df, new_utility_equations=None)[source]#

Apply one of two types of intervention.

This method supports two intervention strategies:

1. Observable attribute changes: Uses the existing fitted model and modifies observable inputs (e.g., prices, features) to simulate how market shares change. This method uses posterior predictive sampling.

2. Product removal: Allows a product to be entirely removed from the choice set and simulates how demand redistributes among the remaining alternatives. This re-specifies and re-estimates the model before posterior prediction.

Parameters:
new_choice_dfpd.DataFrame

The new dataset reflecting changes to observable attributes or product availability.

new_utility_equationslist[str] | None, optional

An updated list of utility specifications for each alternative, if different from the original model. If None, the original equations are reused and only the data is changed.

Returns:
az.InferenceData

The posterior or full predictive distribution under the intervention, including predicted probabilities ("p") and likelihood draws ("likelihood").