# Model specification

The standard Meridian model is a geo-level hierarchical model with non-linear parametric transformations on the media variables. Random coefficients account for heterogeneity across geographical regions.

We recommend using geo-level data as it provides more reliable estimation. A national model, essentially a single-geo model, is available for cases where geo-level data is unavailable.

The Meridian model is an extension of Bayesian models previously proposed (Jin et al. 2017 and Sun et al. 2017). Extensions include the use of reach and frequency data (Zhang et al. 2023) and the inclusion of time-varying intercept terms to model trend and seasonality (related to trend and seasonality modeling by Ng et al. 2021).

The model is represented as follows:

\begin{align*} y_{g,t} = \mu_t &+ \tau_g + \sum\limits_{c=1}^C \gamma_{g,c}z_{g,t,c} \\ &+ \sum\limits_{m=1}^M \beta_{g,m} \text{HillAdstock} \left( \left\{ x_{g,t-s,m} \right\}^L_{s=0}\ ;\ \alpha_m, ec_m, \text{slope}_m \right) \\ &+ \sum\limits_{n=1}^N\ \beta^{(rf)}_{g,n} \text{Adstock} \left( \left\{ r_{g,t-s,n} \cdot \text{Hill} \left( f_{g,t-s,n};\ ec^{(rf)}_n,\ \text{slope}^{(rf)}_n \right) \right\}^L_{s=0}\ ;\ \alpha^{(rf)}_n \right) \\ &+ \epsilon_{g,t} \end{align*}

## Basic details

The basic details are:

• Index variables, as defined in Input data:

• $$g=1,\ldots,G$$ indexes the geographical units
• $$t=1,\ldots,T$$ indexes the time units
• $$c=1,\ldots,C$$ indexes the control variables
• $$m=1,\ldots,M$$ indexes the media channels without reach and frequency data
• $$n=1,\ldots,N$$ indexes the media channels with reach and frequency data
• $$\tau_b = 0$$ for identifiability for some baseline geo $$b$$. Any geo can be set as the baseline using the baseline_group argument.

• $$\{x_{g,t-s,m}\}^L_{s=0}$$ denotes the vector $$(x_{g,t,m},\ x_{g,t-1,m},\ \dots,\ x_{g,t-L,m})$$, and the notation for reach and frequency channels is similar.

• The integer value $$L$$ is the media maximum lag duration, such as the maximum media effect duration. This parameter can be set using the max_lag argument.

• Note the following about the $$\text{Hill}()$$ and $$\text{Adstock}()$$ functions. For more information, see Media saturation and lagging.

$$\text{Adstock} \left( \left\{ q_{t-s} \right\}^L_{s=0},\ \alpha \right) = \dfrac{\sum\limits^L_{s=0}\ \alpha^s y_{t-s}} {\sum\limits^L_{s=0}\ \alpha^s}$$

Where:

• $$q>0,\ 0 \leq \alpha \leq 1$$
• $$\alpha _m$$ and $$\alpha^{(rf)}_n$$ are geometric decay rates
$$\text{Hill} \left( q, ec, \text{slope} \right) = \left( 1 + \left( \dfrac{q}{ec} \right)^{- \text{slope}} \right)^{-1}$$

Where:

• $$q>0,\ ec>0,\ \text{slope} > 0$$
• $$ec_m,\ \text{slope}_m,\ ec^{(rf)}_n,\ \text{slope}^{(rf)}_n$$ are Hill function shape and slope parameters
• The $$\text{HillAdstock}()$$ function depends on the hill_before_adstock argument.

• If the default hill_before_adstock = False, then $$\text{HillAdstock}(q;\ \alpha, ec, \text{slope}) = \text{Hill}(\text{Adstock}(q;\ \alpha);\ ec, \text{slope})$$
• If hill_before_adstock = True, then $$\text{HillAdstock}(q;\ \alpha, ec, \text{slope}) = \text{Adstock}(\text{Hill}(q;\ ec, \text{slope}); \alpha)$$

## $$\mu_t$$ parameters

The $$\mu_t$$ parameters are time-varying intercepts that contribute a trend and seasonality component to the model:

• $$\mu_t$$ are determined by a series of knot parameters $$b_1,b_2,\dots,b_K$$, where $$K$$ is a user-specified number.

• The knots are located at time points between $$1$$ and $$T$$, and the knot positions are specified by the knots argument.

• You can specify a list of knot locations, or just the number of knots.

• If the number of knots is specified, then knots are evenly spaced with two of the knots at the endpoints $$t=1$$ and $$t=T$$.

• When there are multiple geos ($$G>1$$), the default places a knot at each time point $$t=1,2,\dots,T$$.

• When $$G=1$$ (such as a national-level model), the default is a single knot, which is effectively a common intercept across all time periods.

• The $$\mu_t$$ values are a weighted average of the two closest neighboring knots. For any $$t$$, define:

• $$b_0(t)=\max\{b_k:b_k\leq t\}$$ and $$b_1(t)=\min\{b_k:b_k \geq t\}$$

• $$w_0(t)=\ \dfrac{b_1(t)-t}{b_1(t)-b_0(t)}$$

• $$\mu_t =\ w_0(t)b_0(t)\ +\ (1-w_0(t))b_1(t)$$

• The knot values $$b_1,b_2,\dots,b_K$$ have a user-specified prior distribution.

This methodology is based on Bayesian Time Varying Coefficient Model with Applications to Marketing Mix Modeling, with some key distinctions, including the use of a different weight function, distinct priors, the absence of autoregression, and the optional utilization of trigonometric basis functions.

For more information about setting knots, see How the knots argument works.

## Other parameter distributions

Other parameter distributions are as follows:

• Note that here Meridian parameterizes the Normal distribution in terms of its mean and standard deviation.

• $$\gamma_{g,c} \sim \text{Normal}(\gamma_c,\xi_c)$$
• The $$\beta_{g,m}$$ distribution depends on the media_effects_dist argument, as follows:

• $$log(\beta_{g,m})\sim \text{Normal}(\beta_m,\eta_m)$$ if media_effects_dist = LOG_NORMAL

• $$\beta_{g,m}\sim \text{Normal}(\beta_m,\eta_m)$$ if media_effects_dist = NORMAL

• The $$\beta^{(rf)}_{g,n}$$ distribution depends on the media_effects_dist argument, as follows:

• $$\text{log} \left( \beta^{(rf)}_{g,n} \right)\sim \text{Normal} \left( \beta^{(rf)}_n,\eta^{(rf)}_n \right)$$ if media_effects_dist = LOG_NORMAL

• $$\beta^{(rf)}_{g,n} \sim \text{Normal} \left( \beta^{(rf)}_n,\eta^{(rf)}_n \right)$$ if media_effects_dist = NORMAL

• $$\epsilon_{g,t}\sim \text{Normal}(0,\sigma_g)$$:

• The residuals are independent of each other, all media and control variables, and all model parameters.

• If unique_sigma_for_each_geo = False (which is the default), then $$\sigma_1=\sigma_2=\cdots=\sigma_G=\sigma$$.

• The remaining parameters all have user-specified prior distributions:

$$\{\tau_g\}, \{\beta_m\}, \{ \beta^{(rf)}_n \}, \{\eta_m\}, \{ \eta^{(rf)}_n \}, \{\gamma_c\}, \{\xi_c\},$$

$$\{\alpha_m\}, \{ \alpha^{(rf)}_n \}, \{ec_m\}, \{ ec^{(rf)}_n \}, \{\text{slope}_m\}, \{ \text{slope}^{(rf)}_n \}, \{\sigma_g\}$$

You can change some aspects of the model specification, based on modeling options covered in the following sections: Media saturation and lagging, Reach and frequency, Paid search, and ROI priors for calibration. You can also customize the default prior distributions.

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }]
{ "last_modified": "Last updated 2024-07-30 UTC.", "state": "" }