broadcast_over_date#
- pymc_marketing.data.idata.utils.broadcast_over_date(variable, date)[source]#
Repeat a time-invariant variable on every
date.An MMM adds a time-invariant intercept to the linear predictor on every date but stores it without a
datedim. Repeating it on the dates of the per-date variables lets it line up with them, so that summing overdatecounts it once per date like every other component.- Parameters:
- Return type:
xr.DataArray- Returns:
variablewith thedatedim inserted afterchainanddraw(those present), before any other dim, the order the per-date variables of the same group use.
Examples
posterior = mmm.idata.posterior intercept = broadcast_over_date( posterior["intercept_contribution"], posterior["date"] ) intercept.dims # ("chain", "draw", "date", ...)