Marketing data with PyMC3

Standard

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

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s