# Explanation: Core MMM Methodology This document explains the core concepts and techniques used in the Abacus MMM library. *(Placeholder: This section needs content explaining the Bayesian approach, the specific model structure (linear model with transformations), the concept and implementation of geometric adstock, and the concept and implementation of logistic/tanh saturation.)* ## Bayesian Approach Abacus uses a Bayesian framework (via PyMC) for modelling. This means: - Parameters (like channel effectiveness, adstock decay) are treated as probability distributions, not single point estimates. - Prior beliefs about parameters can be incorporated using prior distributions (see {ref}`custom-priors` in the {doc}`Configuration Guide <../guides/configuration>`). - Results are posterior distributions, representing updated beliefs after observing the data. This provides inherent uncertainty quantification (e.g., HDIs). ## Core Model Structure The underlying model is typically a linear regression model on the *transformed* media data: ```{math} y_{t} = \alpha + \sum_{m=1}^{M}\beta_{m}f(x_{m, t}) + \sum_{c=1}^{C}\gamma_{c}z_{c, t} + \varepsilon_{t} ``` Where: - `y_t`: Target variable at time `t`. - `alpha`: Intercept (baseline). - `beta_m`: Coefficient representing the effectiveness of channel `m`. - `f(x_{m, t})`: Transformed media variable for channel `m` at time `t`. This transformation usually involves applying both adstock and saturation. - `gamma_c`: Coefficient for control variable `c`. - `z_{c, t}`: Value of control variable `c` at time `t`. - `epsilon_t`: Error term, typically assumed to be Normally distributed. ## Media Transformations The function `f()` combines two key concepts: ### 1. Adstock (Carry-over Effect) * **Concept:** The effect of advertising lingers beyond the initial exposure period. Past spending continues to influence the target variable. * **Implementation (Geometric Adstock):** Abacus uses a geometric decay model. The adstocked value at time `t` is a weighted sum of current and past spend, where weights decay geometrically based on a decay rate parameter `alpha`. A higher `alpha` means effects decay faster (shorter memory). The `adstock_max_lag` parameter truncates this effect. ```python # Conceptual formula (see core.transformers.geometric_adstock) adstock[t] = x[t] + alpha * adstock[t-1] ``` * **Parameter:** `alpha` (typically Beta distributed, 0 to 1). ### 2. Saturation (Diminishing Returns) * **Concept:** The effectiveness of advertising diminishes as spend increases. The first pound/dollar spent typically has more impact than the millionth. * **Implementation (Logistic/Michaelis-Menten):** Abacus applies a saturation function to the *adstocked* media values. * **Logistic:** Uses a sigmoid-like curve. Controlled by parameter `lam`. Higher `lam` means saturation occurs more quickly. (See `core.transformers.logistic_saturation`). * **Michaelis-Menten:** Uses a curve common in enzyme kinetics, also representing diminishing returns. Controlled by parameters `beta` (representing the maximum effect, similar to Vmax) and `lam` (controlling the shape/steepness, similar to Km). (See `core.transformers.michaelis_menten_saturation`). * **Parameters:** `lam` (typically Gamma distributed for Logistic), or `beta` and `lam` (for Michaelis-Menten). The combination `f(x) = saturation(adstock(x))` captures both the delayed and the diminishing effects of media spend.