Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

name: op-reg-mmm-bayes
description: REG_MMM_BAYES — Bayesian media-mix regression that adstocks raw spend inside the model and samples the posterior with NUTS (or static HMC), returning ROI, marginal ROI and contribution intervals with sampler diagnostics.
kind: operator
category: REG
operator: REG_MMM_BAYES
type: reference
applies_to: process, compose, predict
examples_tags: [regression, time-series, buffered-pipeline]

REG_MMM_BAYES models y = β0 + Σ βc·curve(adstock(rawc; φ); q) + Σ γj·zj + noise: φ and q are posterior, inside every interval.

Use when

Fits a media-mix model with intervals: each channel’s carry-over, response curve and return on spend, beside linear controls.

Questions it answers:

  • What return does each marketing channel earn, and how sure are we?
  • How long does each channel’s effect carry over?

Use something else:

  • REG_MMM_HILL when a fast point estimate over already-adstocked channels is enough, or the fit must be saved, scored or optimised.

Params

channels through carryover sit under params.

NameTypeDefaultDescription
targetfield(required)Response (numeric).
predictors[]field(required)Channels and controls.
channelslist(required)Raw spend (≥ 0).
timestring—Deprecated: order.field.
max_lagfloat13Adstock window.
adstockstringgeometricgeometric, delayed, weibull_cdf, weibull_pdf.
saturationstringhillhill (k, s), logistic (lam), michaelis_menten (k).
priorsobject—Per channel {roi|beta} + kernel/curve keys.
intercept_priorobject—normal(0, 2).
control_priorobject—normal(0, 1).
sigma_priorobject—halfnormal(1).
chainsfloat41–16.
warmupfloat10001–20000.
drawsfloat1000Per chain.
credible_levelfloat0.9—
samplerstringnutsOr hmc.
target_acceptfloat0.8Raise on divergences (geo 0.95).
path_lengthfloat—hmc: required.
step_sizefloat—hmc: fixed.
holdout_fromfloat—Time holdout.
geostring—Panel market field.
per_geo_curvesboolfalse—
lift_testslist——
return_drawsboolfalseoutputs.draws.
draws_thinfloat1Every k-th draw.
carryoverbooltrueHoldout carries adstock.
conf_levelfloat0.95Wald CI.
vcovboolfalsePosterior vcov.
holdoutstring—Row holdout.
savestring——
orderobject—Time field (+ geo partition).
namestring——

Inputs

One row per period (per geo with geo; ragged ends ok). Refused: a gap (time_gap, geo_time_gap; weekly dates), a repeat (duplicate_time), negative spend, [ ] in names.

Output

Coefficients are posterior means; an inline models entry declares them with no fit. outputs: seed, roi, mroi, contribution (per channel, and <ch>[<geo>]), params, diagnostics, holdout, hierarchy, draws; summaries {mean, median, sd, lower, upper} at credible_level.

φ and q coefficients: decay:/peak:/shape:/scale:<ch>, k:/s:/lam:<ch>. response() reads their means.

Reading the output

  • std_errors.*: The posterior standard deviation of each coefficient over every retained draw of every chain: the spread of what the data and the priors allow.
  • p_values.*: a p-value. Below alpha (0.05 unless the request sets another) the result is called significant; that is not the same as important, so read the effect size for how big it is.
  • statistics.*: Always null: the model reports no test statistic.
  • conf_level: The coverage ci_lower and ci_upper were built at (the request’s conf_level, 0.95 by default).

Contract

  • Types (target, predictor): date, datetime, decimal128, f32, f64, packed_bool, u16, u32, u4, u64, u8; any other scalar type is PULSE_FIELD_TYPE_UNSUPPORTED.
  • Types (geo): categorical_*, u16, u32, u4, u64, u8; any other scalar type is PULSE_FIELD_TYPE_UNSUPPORTED.
  • Weight: refused under any weight in force, an instance default included (PULSE_WEIGHT_UNSUPPORTED); weight: null on the slot runs it unweighted.
  • Streaming: buffered only. Always buffered: the model fits over every admitted row.

Gotchas

  • save, scoring, holdout need return_draws; the last two carry adstock (regression-order).
  • k and s (or λ) trade off: judge ROI.
  • Health warns, never refuses (PROCESSING_REGRESSION_DIAGNOSTIC, rhat_high, ess_low, divergences, treedepth_saturated); Options.Strict fails the slot.

See

mmm-bayes-model · mmm-bayes-posterior · mmm-workflow · op-reg-mmm-hill · regression-model-options · regression-spec