# Optimization for media channels with reach and frequency data

For media channels with reach and frequency data, there is an opportunity to optimize the target average ad frequency, in addition to optimizing the budget allocation across channels. However, just because reach and frequency data is available for a channel does not necessarily mean that an advertiser has a high degree of control over the average frequency. Meridian provides the option to perform budget optimization either the optimal average frequency or the historical average frequency for each channel.

• For each channel where historical average frequency is used, it is assumed that the average frequency within each region and time period remains constant, regardless of the budget allocation.

• For each channel where frequency optimization is preferred, Meridian first solves for the optimal frequency value. This optimization constrains the optimal frequency to be equal for all regions and time periods. This restriction serves two purposes: first, to obtain a target frequency strategy that is more practical to implement, and second, to make the optimization routine more tractable. Based on the Meridian model specification, it turns out that the optimal frequency does not depend on the budget allocation.

In either case, the assumption for any given budget level that impressions are allocated according to the historical flighting pattern across geographic regions and time periods. Suppose that you want to compute a budget optimization for a set of regions $G$ and time interval $$[t_0,t_1]$$. Let $$c_n^{(rf)}= \sum\limits_{g \in G} \sum\limits_{t=t_0}^{t_1} u_{g,t,n}^{(rf)} \cdot \ddot r_{g,t,n} \cdot f_{g,t,n}$$ be the actual historical budget for each channel $n$ over the optimization regions and time periods. Denoted is a proposed budget allocation across all channels as a pair of vectors $$b=(b_1,\ldots b_M)$$ and $$b^{(rf)}=(b_1^{(rf)}, \ldots b_N^{(rf)})$$, and a proposed set of average frequency targets as $$f=\{f_{g,t,n}^{\ast}\}$$, where $$f_{g,t,n}^* \geq 1\ \forall g,t,n$$. The asterisk distinguishes the proposed frequency from the historical frequency.

Using the historical flighting pattern, the reach for each geo and time period is defined as:

$$\ddot r_{g,t,n}^{\left( b^{(rf)},f \right)} = \dfrac{ \ddot r_{g,t,n} f_{g,t,n} b_n^{(rf)} }{ f_{g,t,n}^*c_n^{(rf)} }$$ for $$t \in [t_0-L,t_1]$$

and the corresponding transformed media units as:

$$r_{g,t,n}^{(b^{(rf)},f)} = L_{g,n}^{(rf)}\left(\ddot r_{g,t,n}^{(b,f)}\right) = \dfrac{ r_{g,t,n} f_{g,t,n} b_n^{(rf)} }{ f_{g,t,n}^*c_n^{(rf)} }$$

## Optimal frequency

The expected revenue is now a function of the budget vectors $$b$$ and $$b^{(rf)}$$ as well as the target frequencies $$f$$:

$$\begin{multline*} E(ExpectedSales(b,b^{(rf)},f)|Data) = \\ \frac{1}{J} \sum\limits_{j=1}^J \sum\limits_{g \in G} \sum\limits_{t=t_0}^{t_1} u_{g,t}^{(y)} L_g^{(y)-1} \Biggl( \tau_g^{(j)} + \mu_t^{(j)} + \sum\limits_{c=1}^C \gamma_{g,c}^{(j)}z_{g,t,c} + \sum\limits_{m=1}^M \beta_{g,m}^{(j)} HillAdstock \biggl( \Bigl\{ x_{g,t-s,m}^{(b)} \Bigr\}_{s=0}^L; \alpha_m^{(j)}, ec_m^{(j)}, slope_m^{(j)} \biggr) \\ + \sum\limits_{n=1}^N \beta_{g,n}^{(rf,j)} Adstock \biggl( \Bigl\{ r_{g,t-s,n}^{\left(b^{(rf)},f\right)} Hill \Bigl( f_{g,t-s,n}^*; ec_m^{(rf,j)}, slope_m^{(rf,j)} \Bigr) \Bigr\}_{s=0}^L \biggr) \Biggr) \end{multline*}$$

For any given budget allocation and set of target frequencies, the optimal frequency of the $$n^{th}$$ channel is defined as follows:

\begin{align*} f_{optimal,n} &= \underset{f_n}{argmax}\ E \left( ExpectedSales \left( b, b^{(rf)}, f \right) \Big| Data \right) \\ &= \underset{f_n}{argmax}\ \frac{1}{J} \sum\limits_{j=1}^J \sum\limits_{g \in G} \sum\limits_{t=t_0}^{t_1} u_{g,t}^{(y)} L_g^{(y)-1} \Biggl( \beta_{g,n}^{(rj,j)} Adstock \biggl( \Bigl\{ \dfrac{ r_{g,t-s,n} f_{g,t-s,n} b_n ^{(rf)} }{ f_n c_n^{(rf)} } Hill \Bigl( f_n; ec_n^{(rf,j)}, slope_n^{(rf,j)} \Bigr) \Bigr\}_{s=0}^L \biggr) \Biggr) \\ &= \underset{f_n}{argmax}\ \frac{b_n^{(rf)}}{c_n^{(rf)}} \frac{1}{J} \sum\limits_{j=1}^J \sum\limits_{g \in G} \sum\limits_{t=t_0}^{t_1} u_{g,t}^{(y)} L_g^{(y)-1} \Biggl( \beta_{g,n}^{(rf,j)} Adstock \biggl( \Bigl\{ \dfrac{ r_{g,t-s,n} f_{g,t-s,n} }{ f_n } Hill \Bigl( f_n; ec_n^{(rf,j)}, slope_n^{(rf,j)} \Bigr) \Bigr\}_{s=0}^L \biggr) \Biggr) \end{align*}

$$b_n^{(rf)}$$ and $$c_n^{(rf)}$$ factor out of the objective function completely, so the optimal frequency does not depend on the budget allocation. As a result, it is possible to solve for the optimal frequencies first, and then plug in these values to the expected revenue function to optimize the budget allocation.

## Fixed budget optimization

Consider a fixed budget optimization with total budget $$C$$. Define the set of all budget vectors with this total budget as $$B_C = \left\{b, b^{(rf)}: \sum\limits_{m=1}^M b_m + \sum\limits_{n=1}^Nb_n^{(rf)}=C \right\}$$. Meridian provides the option to perform budget optimization based on either the optimal average frequency or the historical average frequency for each channel. The quantity being optimized is expected revenue assuming that the frequency is either optimal or historical frequency, defined as follows:

Expected revenue for optimal frequency:

$$ES_{optimalfreq}\left(b,b^{(rf)}\right) = \sum\limits_{g \in G} \sum\limits_{t=t_0}^{t_1} E\left( \overset \sim Y_{g,t}^{\left(\left\{ x_{g,t,m}^{(b)}, r_{g,t,m}^{(b(rf),optimal)}, f_{optimal,n} \right\}\right)} \Bigg| \left\{ z_{g,t,c} \right\}\right)$$

Expected revenue for historical frequency:

$$ES_{historialfreq}\left(b,b^{(rf)}\right) = \sum\limits_{g \in G} \sum\limits_{t=t_0}^{t_1} E\left( \overset \sim Y_{g,t}^{\left(\left\{ x_{g,t,m}^{(b)}, r_{g,t,m}^{(b(rf),f)}, f_{g,t,n} \right\}\right)} \Bigg| \left\{ z_{g,t,c} \right\}\right)$$

Where $$f_{optimal,n}$$ and $$f_{g,t,n}$$ are predefined properties representing the optimal frequency and the historical frequency for the $$n$$th channel, and therefore there are two parameters, $$b$$ and $$b^{(rf)}$$.

The actual parameter values are unknown. Meridian estimates the expected revenue using a posterior distribution. To optimize the budget, the posterior mean of the expected revenue is utilized as the objective function. The optimal budget vector is defined as follows.

Optimal budget allocation when optimal frequency is used:

\begin{align*} b_{optimal}, b_{optimal}^{(rf)} = \underset{b \in B_C,b^{(rf)} \in B_C}{argmax}\ & E \left[ ES_{optimalfreq}\left( b,b^{(rf)} \right) \Big| Data \right] \\ = \underset{b \in B_C,b^{(rf)} \in B_C}{argmax}\ & \frac{1}{J} \sum\limits_{j=1}^J \sum\limits_{g \in G} \sum\limits_{t=t_0}^{t_1} u_{g,t}^{(y)} L_g^{(y)-1} \Biggl( \sum\limits_{m=1}^M \beta_{g,m}^{(j)} HillAdstock \biggl( \Bigl\{ x_{g,t-s,m}^{(b)} \Bigr\}_{s=0}^L; \alpha_m^{(j)}, ec_m^{(j)}, slope_m^{(j)} \biggr) \\ & + \sum\limits_{n=1}^N \beta_{g,n}^{(rf,j)} Adstock \biggl( \Bigl\{ r_{g,t-s,n}^{\left(b^{(rf)},f_{optimal} \right)} Hill \Bigl( f_{optimal,n}; ec_m^{(rf,j)}, slope_m^{(rf,j)} \Bigr) \Bigr\}_{s=0}^L \biggr) \Biggr) \end{align*}

Optimal budget allocation when historical frequency is used:

\begin{align*} b_{optimal}, b_{optimal}^{(rf)} = \underset{b \in B_C,b^{(rf)} \in B_C}{argmax}\ & E \left[ ES_{historicalfreq}\left( b,b^{(rf)} \right) \Big| Data \right] \\ = \underset{b \in B_C,b^{(rf)} \in B_C}{argmax}\ & \frac{1}{J} \sum\limits_{j=1}^J \sum\limits_{g \in G} \sum\limits_{t=t_0}^{t_1} u_{g,t}^{(y)} L_g^{(y)-1} \Biggl( \sum\limits_{m=1}^M \beta_{g,m}^{(j)} HillAdstock \biggl( \Bigl\{ x_{g,t-s,m}^{(b)} \Bigr\}_{s=0}^L; \alpha_m^{(j)}, ec_m^{(j)}, slope_m^{(j)} \biggr) \\ & + \sum\limits_{n=1}^N \beta_{g,n}^{(rf,j)} Adstock \biggl( \Bigl\{ r_{g,t-s,n}^{\left( b^{(rf)},f \right)} Hill \Bigl( f_{g,t-s,n}; ec_m^{(rf,j)}, slope_m^{(rf,j)} \Bigr) \Bigr\}_{s=0}^L \biggr) \Biggr) \end{align*}

Where:

• $$J$$ is defined to be the total number of MCMC posterior draws.
• The $$j$$th posterior draw of each parameter is denoted with the superscript $$^{(j)}$$.

## Flexible budget optimization

For flexible budget optimization, the expected revenue is optimized while allowing the total budget to vary. The optimization process is subject to constraints imposed by either the minimal marginal return on investment (ROI) or the target ROI constraints. Additionally, the optimization considers either the optimal average frequency or the historical average frequency for each channel.

### Target ROI constraint

When the target ROI is specified. It means Meridian searches over all budget vectors $$b=(b_1,\ldots,b_M)$$ such that the total ROI $$ROI \geq ROI_{target}\ \forall m$$, while allowing the total budget $$\sum\limits_{m=1}^M b_m$$ to vary. The optimal budget vector is defined as follows.

Optimal budget allocation when optimal frequency is used:

\begin{align*} b_{optimal}, b_{optimal}^{(rf)} = \underset{b, b^{(rf)}}{argmax}\ & E \left[ ES_{optimalfreq}\left( b, b^{(rf)} \right) \Big| Data \right] \\ = \underset{b, b^{(rf)}}{argmax}\ & \frac{1}{J} \sum\limits_{j=1}^J \sum\limits_{g \in G} \sum\limits_{t=t_0}^{t_1} u_{g,t}^{(y)} L_g^{(y)-1} \Biggl( \sum\limits_{m=1}^M \beta_{g,m}^{(j)} HillAdstock \biggl( \Bigl\{ x_{g,t-s,m}^{(b)} \Bigr\}_{s=0}^L; \alpha_m^{(j)}, ec_m^{(j)}, slope_m^{(j)} \biggr) \\ & + \sum\limits_{n=1}^N \beta_{g,n}^{(rf,j)} Adstock \biggl( \Bigl\{ r_{g,t-s,n}^{\left(b^{(rf)},f_{optimal}\right)} Hill \Bigl( f_{optimal,n}; ec_m^{(rf,j)}, slope_m^{(rf,j)} \Bigr) \Bigr\}_{s=0}^L \biggr) \Biggr) \end{align*}

$$s.t.\ \dfrac{ \sum\limits_{m=1}^M IncrementalSales_m }{ \sum\limits_{m=1}^M b_m } > ROI_{target}$$

Optimal budget allocation when historical frequency is used:

\begin{align*} b_{optimal}, b_{optimal}^{(rf)} = \underset{b, b^{(rf)}}{argmax}\ & E \left[ ES_{historicalfreq}\left( b, b^{(rf)} \right) \Big| Data \right] \\ = \underset{b, b^{(rf)}}{argmax}\ & \frac{1}{J} \sum\limits_{j=1}^J \sum\limits_{g \in G} \sum\limits_{t=t_0}^{t_1} u_{g,t}^{(y)} L_g^{(y)-1} \Biggl( \sum\limits_{m=1}^M \beta_{g,m}^{(j)} HillAdstock \biggl( \Bigl\{ x_{g,t-s,m}^{(b)} \Bigr\}_{s=0}^L; \alpha_m^{(j)}, ec_m^{(j)}, slope_m^{(j)} \biggr) \\ & + \sum\limits_{n=1}^N \beta_{g,n}^{(rf,j)} Adstock \biggl( \Bigl\{ r_{g,t-s,n}^{\left(b^{(rf)},f\right)} Hill \Bigl( f_{g,t-s,n}; ec_m^{(rf,j)}, slope_m^{(rf,j)} \Bigr) \Bigr\}_{s=0}^L \biggr) \Biggr) \end{align*}

$$s.t.\ \dfrac{ \sum\limits_{m=1}^M IncrementalSales_m }{ \sum\limits_{m=1}^M b_m } > ROI_{target}$$

Where the target ROI constraint is applied at the total marketing ROI level, and not at channel level.

### Minimal mROI constraint

When the minimal marginal ROI is specified, Meridian searches over all budget vectors $$b=(b_1, \ldots, b_M)$$ such that the marginal ROI $$mROI_m \geq mROI_{minimal}\ \forall m$$, while allowing the total budget $$\sum\limits_{m=1}^M b_m$$ to vary. The optimal budget vector is defined as follows:

Optimal budget allocation when optimal frequency is used:

\begin{align*} b_{optimal}, b_{optimal}^{(rf)} = \underset{b, b^{(rf)}}{argmax}\ & E \left[ ES_{optimalfreq}\left( b, b^{(rf)} \right) \Big| Data \right] \\ = \underset{b,b^{(rf)}}{argmax}\ & \frac{1}{J} \sum\limits_{j=1}^J \sum\limits_{g \in G} \sum\limits_{t=t_0}^{t_1} u_{g,t}^{(y)} L_g^{(y)-1} \Biggl( \sum\limits_{m=1}^M \beta_{g,m}^{(j)} HillAdstock \biggl( \Bigl\{ x_{g,t-s,m}^{(b)} \Bigr\}_{s=0}^L; \alpha_m^{(j)}, ec_m^{(j)}, slope_m^{(j)} \biggr) \\ & + \sum\limits_{n=1}^N \beta_{g,n}^{(rf,j)} Adstock \biggl( \Bigl\{ r_{g,t-s,n}^{\left(b^{(rf)},f_{optimal}\right)} Hill \Bigl( f_{optimal,n}; ec_m^{(rf,j)}, slope_m^{(rf,j)} \Bigr) \Bigr\}_{s=0}^L \biggr) \Biggr) \end{align*}

$$s.t.\ mROI_m(b_m) > mROI_{minimal}\ \forall m$$

Optimal budget allocation when historical frequency is used:

\begin{align*} b_{optimal}, b_{optimal}^{(rf)} = \underset{b, b^{(rf)}}{argmax}\ & E \left[ ES_{historicalfreq}\left(b, b^{(rf)} \right) \Big| Data \right] \\ = \underset{b, b^{(rf)}}{argmax}\ & \frac{1}{J} \sum\limits_{j=1}^J \sum\limits_{g \in G} \sum\limits_{t=t_0}^{t_1} u_{g,t}^{(y)} L_g^{(y)-1} \Biggl( \sum\limits_{m=1}^M \beta_{g,m}^{(j)} HillAdstock \biggl( \Bigl\{ x_{g,t-s,m}^{(b)} \Bigr\}_{s=0}^L; \alpha_m^{(j)}, ec_m^{(j)}, slope_m^{(j)} \biggr) \\ & + \sum\limits_{n=1}^N \beta_{g,n}^{(rf,j)} Adstock \biggl( \Bigl\{ r_{g,t-s,n}^{\left( b^{(rf)},f \right)} Hill \Bigl( f_{g,t-s,n}; ec_m^{(rf,j)}, slope_m^{(rf,j)} \Bigr) \Bigr\}_{s=0}^L \biggr) \Biggr) \end{align*}

$$s.t.\ mROI_m(b_m) > mROI_{minimal}\ \forall m$$

Where the minimal mROI is applied at channel level and not at the total marketing level.

## Channel-level spend constraints

Channel-level spend constraints are available for both fixed and flexible budget optimization to prevent unreasonable optimization outcomes such as putting all spend into one single channel. The channel-level spend constraint is defined as:

$$(b_m^{'} \times LB_m) \leq b_m \leq (b_m^{'} \times UB_m) \space \forall m$$

Where:

• $$b_m^{'}$$ is the non-optimized spend for channel $m$.
• $$LB_m$$ is the user-specified lower bound with the value between $$0$$ and $$1$$.
• $$UB_m$$ is the user-specified upper bound with the value greater than $$1$$.
[{ "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" }]