Thoughts on Marketing Mix Modeling?

We've recently been exploring Marketing Mix Modeling (MMM) in order to help gauge where some of our unattributed traffic is coming from. Essentially, building a simple linear regression in Python with spend by channel as the independent variables, and total website traffic as the dependent variable. 

Here is the current model script.

# Regress unattributed organic to paid leads to see what fraction of organic
# would be lost if we cut paid spend.

# Factors out bad emails and makes a decent effort to categorize leads by
# referrer and url of first touch.

import sys, scipy, csv
import pandas as pd
import statsmodels.api as sm

script_name = 'regression_mystery_organic_from_paid'
filename = '20161130_us_traffic_reorganized_channels'

def load_data_frame():
  df = pd.read_csv('data/' + filename + '.csv', index_col=0)
  df.index = pd.to_datetime(df.index)
  return df

def ols_summary(df, x_cols, y_col, *m):
  if m:
    mask = m
    df = df.loc[m]
  X = df[x_cols]
  X = sm.add_constant(X)
  y = df[y_col]
  est = sm.OLS(y, X).fit()

def print_and_save_summary(est):
  summary = est.summary()
  output_filename = 'output/' + script_name + '__' + filename
  print "\n\nSaving summary to " + output_filename
  f = open(output_filename, 'w')

  print summary

if __name__ == "__main__":
  df = load_data_frame()
  ols_summary(df, ['facebook_ads', 'google_ads', 'twitter_ads'], ['unattributed'], (df.index >= '7/04/2016'))


Has anyone had any success using the method?

I have been also toying with s-curves, as explained by this blog post:

I am still very open to ways to optimize this kind of modeling. Any ideas? 



4replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Sean!

    This has been pretty useful, thanks!

    I've been doing a bit more reading and stumbled upon this post, it does a really good job at explaining other variables to consider (like adstock) and how to work with them to add more meaningful features.

    I'll post my results once I get further into the research on my own data.

    Reply Like
  • Thanks Andres! 

    The code I posted is definitely a bit different than a strictly traditional MMM because my goal is find what is driving organic traffic.

    I do have a model with adstock effect added somewhere, I am going to dig that up. Played with it about a year ago.

    Are you mostly working with digital advertising or do you have offline traffic you want to model as well? We are about to dive into some offline channels.

    Looking forward to your results!

    Reply Like
  • We're only looking into the organic driven by our digital ads, we have some offline traffic but it's very minimal

    Reply Like
  • If you're primarily running digital, why not track digitally? URLs, tags, pixels, etc., are far more effective at determining even view through performance. If you truly believe digital ads have "unattributable" impact, you should be able to run an experiment to figure that out pretty easily. Either as a holdout group on the impression level, run through a publisher, or as a macro whiteout/blackout test.

    Media Mix Modeling won't be as powerful as those simple experiments, and not as useful against digital spend. If you're not running large amounts of traditional media, and varying that spend a lot, you won't have much power behind it.

    Reply Like
Like4 Follow
  • 1 yr agoLast active
  • 4Replies
  • 1132Views
  • 4 Following