Markov Chain Attribution Models

While the use of markov chains to understand attribution models has existed for a while, until now there haven’t been any widely available python modules or code to demonstrate its capabilities in a proof of concept.

I’ve gone through the work of building out a dynamic markov model PoC in Python that accepts a list of channel touchpoints, leading to either a “conversion” or “not a conversion”.

See the github repo here.

The methodology has been explained in depth numerous times before so if you’re interested in learning more about the methodology behind using a markov chain for the purposes of understanding attribution, I’d recommend visiting either of those links.

Basically the solution to the problem boils down to taking each and every user path that occurred over a given period of time, grouping them by the path and summing the conversions and dividing that into the total number of times the path occurred to derive a transition matrix.

Once you have the transition matrix, you can run simulations through the transition matrix thousands of times to estimate the removal effect of a particular channel or tactic. This removal effect can be seen of as what percentage of conversions would you lose if you removed that channel or tactic entirely.  Essentially you can take that removal effect and derive the number of conversions.

Currently the linked-to repo that I built out is a simple 1st order markov model.  Higher order models could be created built off of the same methodology.