create_zero_dataset#

pymc_marketing.mmm.utils.create_zero_dataset(model, start_date, end_date, channel_xr=None, include_carryover=True)[source]#

Create an xr.Dataset for future prediction, with zero fills.

Creates a dataset with dates from start_date to end_date and all model dimensions, filling channel and control variables with zeros (or with values from channel_xr if provided). The output has the canonical underscore variable names (_channel, _control).

Parameters:
model

Fitted MMM instance. Must have xarray_dataset, date_column, channel_columns, control_columns, dims and adstock attributes.

start_date, end_date

Date range for the prediction period.

channel_xr

Optional per-dimension channel values. Data variables must be a subset of model.channel_columns. Dimensions must be a subset of model.dims and must not include the date dimension. Values are broadcast across every date in the generated range.

include_carryover

Whether to extend the date range by adstock.l_max periods so that adstock initialisation has enough leading observations.

Returns:
xr.Dataset

Dataset with _channel (and optionally _control) variables, indexed by ("date", *dims, "channel").