Incrementality.spend_over_contribution#
- Incrementality.spend_over_contribution(frequency, start_date=None, end_date=None, include_carryover=True, num_samples=None, random_state=None)[fuente]#
Compute spend per unit of incremental contribution.
Reciprocal of
contribution_over_spend(). The interpretation depends on the model’s target variable – e.g. CAC (Customer Acquisition Cost) when the target is customer count- Parameters:
- frequency{«original», «weekly», «monthly», «quarterly», «yearly», «all_time»}
Time aggregation frequency.
- start_date, end_date
strorpd.Timestamp, optional Date range for computation.
- include_carryoverbool, default=True
Include adstock carryover effects.
- num_samples
intorNone, optional Number of posterior samples to use. If None, all samples are used.
- random_state
RandomStateorGeneratororNone, optional Random state for reproducible subsampling.
- Returns:
xr.DataArraySpend per unit contribution with dimensions
(chain, draw, date, channel, *custom_dims). Zero contribution results in Inf; zero spend results in NaN.
Examples
>>> cac = mmm.incrementality.spend_over_contribution( ... frequency="monthly", ... )