Echo/Docs

CLI command

mmm

The marketing mix model: each channel's contribution to an outcome, fitted on its weekly ad spend and recorded costs carried over into later weeks, with intervals, every refit stored with the weeks it used.

Invocation#

Shell
echo-cli mmm fit --weeks <weeks> --currency <code> --outcome-event <name> [--value-property <name>] --sigmas <n> --carryover <share> --by <name>
echo-cli mmm list

Inputs and output#

fit writes the stored fit: id, fitted_at, fitted_by, currency, outcome_event, value_property, sigmas, panel (from, to, channels and, per week, each channel's spend, costs — the part of that spend recorded with analytics costs record — and the outcome) and fit: baseline and, per channel, coefficient and contribution, each with estimate, standard_error, low and high, plus carryover, r_squared and residual_degrees_of_freedom. list writes every stored fit, newest first; a fit stored before carry-over was fitted has no carryover and was fitted on each week's spend alone, and a panel stored before recorded costs were read has no costs.

State effect#

Both verbs call Echo Web's authenticated /api/analytics/mmm with ECHO_INTERNAL_BEARER at ECHO_WEB_BASE_URL; the Marketing mix section of the tracking screen and of Echo Desktop's GEO screen fits and lists the same, and echo-mcp lists fits (echo_list_mmm_fits) but cannot fit. The panel holds the last --weeks whole ISO weeks, ending at the start of the current one: each channel's spend in --currency — the ad spend its platform reported, read from ad_campaign_metrics through the campaigns of ad accounts that declare that currency, plus the costs recorded for that channel in that currency (channel_costs, as echo-cli analytics costs record writes them: agency fees, sponsorships, or a channel with no ads at all), each spread evenly over the days its period covers — and each week's outcome, the count of web and mobile events named --outcome-event or, with --value-property, the sum of the number each holds there. Each channel's spend is turned into adstock: a week's adstock is its spend plus --carryover times the adstock of the week before (0 is the week's spend alone; 0.5 keeps half of last week's effect), so spend keeps working after the week it was paid in. The model is ordinary least squares of the outcome on a baseline and each channel's log(1 + adstock), so each channel's returns diminish; an interval is the estimate plus or minus --sigmas standard errors, and a contribution is the coefficient times the channel's summed log adstock. mmm allocate reads the same carry-over: a steady weekly spend builds an adstock of spend / (1 - carryover). Every fit is stored with its panel; nothing is overwritten.

Refusals#

  • A wrong invocation is refused before anything is sent: "mmm takes fit …; list; forecast …; got <word>", "mmm fit does not take <flag>; it takes …", "<flag> needs a value", "mmm fit needs <flag>" for each of --weeks, --currency, --outcome-event, --sigmas, --carryover and --by, "--weeks must be a number; got <text>" (and --sigmas and --carryover) and "mmm list takes nothing; got …"; forecast is described on the mmm-forecast page.
  • Echo Web answers a bad request with "weeks must be a positive whole number: how many whole weeks the panel holds", "currency is required: …", "outcome_event is required: …", "sigmas must be a positive number: how many standard errors each interval spans", "carryover is required as a number", "carryover must be at least 0 and below 1: the share of a week's spend effect carried into the next week, 0 for none; got <value>", "campaign <id> reported no spend on <day>, so its week cannot be measured", "an <event> event at <time> holds no number under <property>, so the week's outcome cannot be summed", "the panel holds no channel with spend in that currency, so there is nothing to fit", "the model needs at least <n> weeks (one per channel, one for the baseline and one to measure the error); the panel has <m>", "the panel cannot separate <channel> from the others: its spend is the same every week or moves exactly with another channel's" or "the outcome is the same every week of the panel, so no spend can explain it".