Marketing data with PyMC3

My friend Erik put up an example of conversion analysis with PyMC2 recently. I decided to reproduce this with PyMC3.

We want a good model with uncertainty estimates of various marketing channels.

I’ll restate his assumptions for the model and then show the gist.

Let’s make some assumptions about the model:

  1. The cost per transaction is an unknown with some prior (I just picked uniform)
  2. The expected number of transaction is the total budget divided by the (unknown) cost per transaction
  3. The actual observed number of transactions is a Poisson of the expected number of transactions

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Here we can see that it is possible to get a good model of a conversion analysis using MCMC.

I think in the future I like Erik will use PyMC2 and PyMC3 more often for simple analysis like this. As I’ve repeatedly said this is a powerful method for generating a generative story that can be explained easily to stakeholders. We can also bring their ‘human intelligence’ into the model generation process. It may be possible that the head of marketing knows that the prior is not uniform – for example.

I will definitely use it for some further funnel analysis – in particular when the number of data points is very small and the model is very complex. I’m keen to hear other examples of PyMC3 in the wild.

Leave a Reply

Your email address will not be published.