# Markov Chain and Removal Effect

Based on this article I'm trying to use within R the Channel Attribution package to leverage on the Markov Chain in order to attribute conversion between several marketing channel.

On one point the author suggest:

" When using one-order Markov chains, a subsequence of the same channels in a path (duplicates) can be reduced to one channel (for example C2 in the path C1 → C2 → C2 → C2 → C3 can be reduced to C1 → C2 → C3). Because, mathematically, it doesn’t matter how many times each C2 goes through the loop with itself in the transition matrix, it will be in the C3 state finally. Therefore, we will obtain different transition matrices but the same Removal Effect for channels with or without subsequent duplicates ".

Now, I utilized another set to validate the package result. Specifically:

If I take the example in the picture, where I simulated an hypothetical set of paths, with both number of conversions and not conversions represented in the coloured cells (in the green and red cells respectively)

Doing the math by hand I get the following transition probabilities for the 1st order Markov chain:

However, when I do the calculation by hand to get the removal_effect and total_conversion, I do not get the same results of the package for each channel.

According to the theory and the example in the article, the total probability of conversion of the model should be = (1*0.1008*0.5455*0.1261) + (0.1765*0.2605*0.0323) +(0.2605*0.3226*0.1818) + 0.1261=0.1498

Then the removal effects:

instagram=1-((0.0069+0.1261)/0.1498)=0.1121

Then to compute the share of conversion, let's say of google

share google=1/(1+0.1482+0.1121)=0.7935 * 20 conversions =15.87

while the attribution channel package give me different results as per below

I think I'm missing something in my calculation respect to what the code does.

Does anyone with some experience with Markov chain help with identifying what is not right in the manual computation?

Many thanks D