Marketing Mix Models


I am interested in building a marketing mix model with brms. I recently read a great paper on marketing mix models in stan .

This may be a stretch, but does anyone in this community have experience building a marketing mix model in brms? If so do you have some code you can share?


When I skimmed the paper and read ROAS, I had to think about @mrojala and the thread below. Maybe it’s a starting point, even if it the connection right now is only based on keyword matching (and not directly referring to brms but Stan):

Tutorial: How We Productized Bayesian Revenue Estimation with Stan


I currently don’t have time to read the paper, but maybe you can give me a quick summary of how such a model looks like? I can then try to formulate that with brms.


Sure, the following are the common expected deliverables/objectives of MMMs in the marketing industry as I understand them.

Primary Objectives

Given observational data on competitor spend, price of products sold, weather, gdp:

  1. What is the effect of various marketing channels, such as TV, radio, online, mailed-coupons, etc. on sales

  2. What is the optimal amount of money to spend in each of the marketing channels. This is usually also used to suggest a potential Return On Investment (ROI) if a company did spend the amount suggested by the model

Usually this problem is solved by multiple regression.

Secondary Objective

A secondary objective to MMM is to report on the decay and lag effect of an ad. This is convoluted due to the fact that we try to ascertain the effect of media from observation, not experimentation, but it is an expected deliverable from an MMM.

It is thought that each media channel has a different rate of decay and lag effect on sales. It is therefore required to find this decay rate and lag effect. These values also become important results on their own, even-though they are not primary objectives of the MMM. Often managers will ask a question such as, what is the half life of TV and if TV is associated with increased sales on the week the ad is shown or a couple weeks after.

This is the main topic of the paper I linked to above and the part I am most interested in.

I think that the brms packages is in a better position to answer this part of MMMs better than other packages because of its flexibility in modeling and its ease of use for the user.

Helpful Resources

Automatic MMM Data Generation in R: dammmdatagen

One Approach to MMM in R: (description | code)

Note: The “Mix” In Marketing Mix Model refers to the mix in ad-spend. It has nothing to do with the type of model. In other words it does not suggest “mixed models”, though a “mixed model” could be used. This was a point of confusion for me when I first heard the term.


Regarding primary objectives, this can both be done in brms, as multiple regression is supported and you can extract model predictions (e.g. via predict()) and feed them into you loss functions for decision making.

Regarding the secondary objective, I cannot speak with certainty because I am lacking subject matter knowledge in your area. But if you can express the model in terms of a response variable, which is predicted using a (non-) linear formula of data and parameters, you can use brms. Maybe vignette(brms_nonlinear) can help you.