This is the deep-dive module. If you are an experienced hire arriving from a Bayesian MMM background (Meridian, Robyn, LightweightMMM), read it first - it is where this program's engine differs most from what you know. If you are a fresh analyst, aim to recognize the vocabulary, not to derive the filter; treat the math as reference.
A brand's weekly sales series is not a flat line plus media bumps. It carries a slow-moving trend (the brand growing or fading), seasonal rhythm (festive quarters, summer categories), medium-term cycles that are not strictly periodic, and plain noise. Plain OLS forces one fixed intercept onto all of that: whatever the intercept cannot absorb leaks into the media coefficients, and the model happily "explains" a rising brand trend as media effect. The industry's Bayesian MMM stacks attack the same problem differently - priors over coefficients, posterior sampling - at the cost of a prior-elicitation burden and less interpretable baseline structure.
This program's engine takes the structural route: an Unobserved Components Model (UCM), also known as structural time-series modelling. Instead of treating the series as a black box, UCM explicitly models the underlying structure - each component is a latent (unobserved) variable, and the model estimates how the components evolve over time. The payoffs the methodology workbook names: interpretability (you can see how much variation is trend vs seasonality vs media), flexibility (handles missing data and structural breaks), and robust forecasting. And the baseline the UCM separates out is not a by-product - it is the very quantity the LT model family re-opens and splits into brand-health pillars (module 2.1).
The canonical UCM writes the observed series as a sum of unobserved components:
y_t- the observed time series (weekly sales volume)mu_t- the trend: long-term progression of the levelgamma_t- the seasonal component: repeating periodic fluctuationspsi_t- the cyclical component: medium-term oscillations that are not strictly periodicepsilon_t- the irregular component: white noise, the randomness nothing else explains
Each component is estimated, not assumed constant. That single fact is what lets the model tell a slow brand-health drift apart from a fast promotional spike sitting on top of it.
To estimate latent components, the UCM is cast in state-space form - two equations with two distinct jobs. The workbook's teaching case is the local level regression: a regression whose intercept (level) is allowed to wander over time.
Read them as a division of labour: the local level mu_t soaks up slow-moving changes in the baseline (underlying market trend, demand shifts), while the regression part x_t' beta captures the effect of predictors - advertising spend, promotions. Because the level is free to move, it cannot be confused with media effects, and vice versa. The coefficients beta may be fixed, or themselves modelled as time-varying states - that is what dynamic regression coefficients means: a coefficient promoted into the state vector so its evolution is estimated too.
The Kalman filter is the algorithm that recursively estimates the hidden state from noisy observations - optimal when the system is linear and all noise is Gaussian (Gaussian noise is what lets the filter describe uncertainty fully with a mean and a variance, apply Bayesian updating in closed form, and keep the state's posterior Gaussian at every step). It walks the series one period at a time, and at each period does two things:
- Prediction step: before seeing this week's sales, predict the state from the last one - for the local level, the best guess for
mu_tis simplymu_(t-1)- and widen the uncertainty to admit that the state may have drifted. - Update step: now look at the actual observation
y_t. Compute the surprise (how far the observation landed from the prediction), then move the state estimate part-way toward the observation. How far it moves is governed by the Kalman gain.
The Kalman gain, in words, is a trust ratio: it compares how uncertain the model is about its own prediction against how noisy observations are known to be. When the prediction is shaky and the data is clean, the gain is high and the new observation pulls the estimate strongly. When the prediction is confident and the data is noisy, the gain is low and the observation barely nudges it. Formally, for the local level:
Beyond estimating the level, the workbook flags two practical bonuses in the state-space regression setting: missing data is handled naturally (the filter simply skips the update step for a missing week and carries the prediction forward), and the filter cleanly separates signal from noise (state vs observation error).
The filter also yields the model's fit measure for free. At each step, the one-step-ahead prediction error is called the innovation, v_t = y_t - y_hat_(t|t-1), with variance F_t. Because innovations are Gaussian under the model, they assemble directly into the log-likelihood:
Three uses, per the workbook: model fitting (maximize the log-likelihood to estimate the noise variances), model comparison (compute AIC/BIC from the log-likelihood to compare candidate state-space specifications), and forecast evaluation (lower log loss = better predictive performance). When module 2.6's priority_order ranks candidate models on MAPE, adjusted R² and residual diagnostics, this likelihood machinery is what sits underneath the candidates being ranked.
Where to go deeper
Two standard texts cover this entire family properly: Durbin & Koopman, Time Series Analysis by State Space Methods (the reference text for state-space estimation) and Harvey, Forecasting, Structural Time Series Models and the Kalman Filter (the canonical UCM formulation).
Explain it to a client in three sentences. Using the decomposition y_t = mu_t + gamma_t + psi_t + epsilon_t, write a three-sentence, jargon-free explanation of why this model can separate a slow brand-health trend from a fast promotional spike. Constraints: no equations, no "Kalman", no "latent". Compare your version with a colleague's - the best ones usually talk about a moving baseline that is tracked week by week, so that anything fast and sharp on top of it must be explained by something else.
MathCo Methodology Understanding_UL.xlsxsheetsUCM Theory(the y_t = mu_t + gamma_t + psi_t + epsilon_t decomposition and the why-UCM list),State space model Theory(local level regression, observation/state equations, monthly-sales use case, Gaussian-noise rationale),Kalman Filtering(prediction/update steps, Kalman gain, dynamic coefficients, missing-data handling),Log Loss Function(innovations, log-likelihood, AIC/BIC uses)- External reference texts: Durbin & Koopman, Time Series Analysis by State Space Methods; Harvey, Forecasting, Structural Time Series Models and the Kalman Filter (lineage pending SME confirmation, see marker above)