To keep a business running, spending money on advertising is crucial — this is the case regardless of whether the company is small or already established. And the number of ad spendings in the industry are enormous:

Source:, (article updated in 2020)

These volumes make it necessary to spend each advertising dollar wisely. However, this is easier said than done, or as US retail magnate John Wanamaker or UK industrialist Lord Leverhulme put it about a hundred years ago:

“Half the money I spend on advertising is wasted; the trouble is I don’t know which half.”

You might think that this is less of a problem nowadays, but strangely enough, it still persists. Luckily, we are in the position of having access to a lot of data and powerful computers to change this state of affairs through advanced analyses, such as Attribution Modeling or Marketing Mix Modeling. In this article, we will focus on the latter.

Imagine now that you are responsible for the marketing budget of some established company. To increase sales, you play advertising in three different advertising channels:

The Data

In each week, you decide to spend some amount of money on each channel, or not. Additionally, you get to observe the number of sales each week. The data collected for 200 weeks might look like this:

Image by the author.

All numbers from the table are in a currency of your choice, I’ll use € from now on. You can get the above file here.

From the small sneak peek above, we can see that there are a lot of weeks without TV advertising (71%), and also some without radio ads (54%). Web banners are only disabled in around 24% of the observations, making it the most frequently used channel.

However, when we make TV spendings, they tend to be higher than radio spending, which in turn are higher than web banner advertising spending. Furthermore, there are sales all the time.

Now, before we start modeling, let us clarify the goal first.

The Goal

In the end, we want to be able to answer questions such as

How much of the 15,904.11 € sales in the week ending on 2021–10–10 (see table above) was generated by TV advertising? And how much by radio and web banners? And what is the baseline, i.e. the number of sales we would have had without any advertising?

A potential result. Image by the author.

If our model can do this, we can also use it to compute ROIs and optimize spending, which is what companies ultimately…

Continue reading:—-7f60cf5620c9—4