# LightweightMMM Models.

The LightweightMMM can either be run using data aggregated at the national level (standard approach) or using data aggregated at a geo level (sub-national hierarchical approach). These models are documented below.

## National level (standard approach)

All the parameters in our Bayesian model have priors which have been set based on simulated studies that produce stable results. We also set out our three different approaches to saturation and media lagging effects: carryover (with exponent), adstock (with exponent) and hill adstock. Please see Jin, Y. et al., (2017) for more details on these models and choice of priors.

*Intercept*

\(\alpha \sim HalfNormal(2)\)

*Trend*

\(trend_{t} = \mu t^{\kappa}\)

\(\mu \sim Normal(0,1)\)

\(\kappa \sim Uniform(0.5,1.5)\)

Where \(t\) is a linear trend input

*Seasonality (for models using* **weekly observations**)

\(seasonality_{t} = \displaystyle\sum_{d=1}^{2} (\gamma_{1,d} cos(\frac{2 \pi dt}{52}) + \gamma_{2,d} sin(\frac{2 \pi dt}{52}))\)

\(\gamma_{1,d}, \gamma_{2,d} \sim Normal(0,1)\)

*Seasonality (for models using* **daily observations**)

\(seasonality_{t} = \displaystyle\sum_{d=1}^{2} (\gamma_{1,d} cos(\frac{2 \pi dt}{365}) + \gamma_{2,d} sin(\frac{2 \pi dt}{365})) + \delta_{t \bmod 7}\)

\(\gamma_{1,d}, \gamma_{2,d} \sim Normal(0,1)\)

\(\delta_{i} \sim Normal(0,0.5)\)

*Other factors*

\(other\ factors_{t} = \displaystyle\sum_{i=1}^{N} \lambda_{i}Z_{it}\)

\(\lambda_{i} \sim Normal(0,1)\)

Where \(Z_{i}\) are other factors and \(N\) is the number of other factors.

*Media Effect*

\(\beta_{m} \sim HalfNormal(v_{m})\)

Where \(v_{m}\) is a scalar equal to the sum of the total cost of media channel \(m\).

*Media Channels (for the* **carryover** *model)*

\(media\ channels_{t} = x_{t,m}^{*\rho_{m}}\)

\(x_{t,m}^{*} = \frac{\displaystyle\sum_{l=0}^{L} \tau_{m}^{(l-\theta_{m})^2}x_{t-l,m}}{\displaystyle\sum_{l=0}^{L}\tau_{m}^{(l-\theta_{m})^2}}\) where \(L=12\)

\(\tau_{m} \sim Beta(1,1)\)

\(\theta_{m} \sim HalfNormal(2)\)

\(\rho_{m} \sim Beta(9,1)\)

Where \(x_{t,m}\) is the media spend or impressions in week \(t\) from media channel \(m\)

*Media Channels (for the* **adstock** *model)*

\(media\ channels_{t} = x_{t,m,s}^{*\rho_{m}}\)

\(x_{t,m,s}^{*} = \frac{x_{t,m}^{*}}{1/(1-\lambda_{m})}\)

\(x_{t,m}^{*} = x_{t,m} + \lambda_{m} x_{t-1,m}^{*}\) where \(t=2,..,N\)

\(x_{1,m}^{*} = x_{1,m}\)

\(\lambda_{m} \sim Beta(2,1)\)

\(\rho_{m} \sim Beta(9,1)\)

Where \(x_{t,m}\) is the media spend or impressions in week \(t\) from media channel \(m\)

*Media Channels (for the* **hill_adstock** *model)*

\(media\ channels_{t} = \frac{1}{1+(x_{t,m}^{*} / K_{m})^{-S_{m}}}\)

\(x_{t,m}^{*} = x_{t,m} + \lambda_{m} x_{t-1,m}^{*}\) where \(t=2,..,N\)

\(x_{1,m}^{*} = x_{1,m}\)

\(K_{m} \sim Gamma(1,1)\)

\(S_{m} \sim Gamma(1,1)\)

\(\lambda_{m} \sim Beta(2,1)\)

Where \(x_{t,m}\) is the media spend or impressions in week \(t\) from media channel \(m\)

## Geo level (sub-national hierarchical approach)

The hierarchical model is analogous to the standard model except there is an additional dimension of region. In the geo level model seasonality is learned at the sub-national level and at the national level. For more details on this model, please see Sun, Y et al., (2017).