The MKTATTRIBUTION Procedure
Examples: MKTATTRIBUTION Procedure
This section provides an example of the model that the MKTATTRIBUTION procedure supports.
The following statements read a data table that contains records of 2 million customer visits. The table has four columns: sec is the number to identify the customers, time is the time when the customer visits, c is a nonnegative integer variable that is converted from the channel variable and is to be used in the model, and channel is the channel that the customer visits at time t.
data marketData;
format time DATETIME.;
input sec time:ANYDTDTM40. c channel & $ 15. ;
datalines ;
1 24MAY18:00:00:00 1 Direct Mail
1 05JUN18:23:25:55 4 email
1 05JUN18:23:26:36 0 conversion
2 13JUN19:18:05:25 11 social
2 26OCT19:03:44:08 4 email
3 22AUG19:13:25:49 7 paid social
4 28JUL19:00:52:21 7 paid social
... more lines ...
1169566 15JUN18:11:18:33 5 organic
1169567 05MAY18:00:00:00 1 Direct Mail
1169567 03APR20:05:40:37 5 organic
1169567 03APR20:12:02:20 0 conversion
1169568 07SEP19:21:50:07 7 paid social
1169569 04MAY19:15:44:22 5 organic
1169570 14AUG18:15:14:56 11 social
1169570 21OCT19:00:00:00 1 Direct Mail
1169571 15MAY19:19:32:36 7 paid social
;
The following statements create the table (Figure 13) to show the one-to-one relationship of channel to c:
data channel;
set marketData(keep=c channel);
run;
proc sort data=channel
dupout=channel_NoDupkey nodupkey;
by c;
run;
proc print data=channel noobs; var c channel; run;
Figure 13: Market Channels
| c | channel |
|---|---|
| 0 | conversion |
| 1 | Direct Mail |
| 2 | app |
| 3 | display |
| 4 | |
| 5 | organic |
| 6 | paid search |
| 7 | paid social |
| 8 | phone |
| 9 | |
| 10 | sms |
| 11 | social |
| 12 | video |
| 13 | web |
In addition to the conversion, which equals 0, in the c variable, there are 13 distinctive channels shown in Figure 13.
The following statements estimate the Markov attribution model that has 13 channels:
proc sort data=marketData out=marketData nodupkey;
by sec time;
run;
data mycas.marketData2;
set marketData;
run;
proc mktattribution data=mycas.marketData2;
id section=sec time=time;
model c / nchannel=13;
output outremoval=mycas.rm outcontribution=mycas.contribution outtpm=mycas.tpm ;
run;
The model information and number of observations are shown in Figure 14.
Figure 14: Model Information and Number of Observations
| Model Information | |
|---|---|
| Model Type | Markov Attribution |
| Number of Channels | 13 |
| Number of Observations | 2045016 |
|---|---|
| Number of Missing Observations | 0 |
The estimates of the initial state probability vector are shown in Figure 15.
Figure 15: Estimates of Initial State Probability Vector
| Initial State Probability Vector | |
|---|---|
| State | Estimate |
| Channel 1 | 0.20354 |
| Channel 2 | 0.00003 |
| Channel 3 | 0.00706 |
| Channel 4 | 0.10067 |
| Channel 5 | 0.20121 |
| Channel 6 | 0.04194 |
| Channel 7 | 0.34759 |
| Channel 8 | 0.00027 |
| Channel 9 | 0.00159 |
| Channel 10 | 0.00141 |
| Channel 11 | 0.07281 |
| Channel 12 | 0.00330 |
| Channel 13 | 0.01859 |
| Conversion | 0.00000 |
| Null | 0.00000 |
The estimated transition probability matrix are shown in Figure 16.
Figure 16: Estimated Transition Probability Matrix
| Estimated Transition Probability Matrix | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| State | Channel 1 | Channel 2 | Channel 3 | Channel 4 | Channel 5 | Channel 6 | Channel 7 | Channel 8 | Channel 9 | Channel 10 | Channel 11 | Channel 12 | Channel 13 | Conversion | Null |
| Channel 1 | 0.00000 | 0.00002 | 0.00896 | 0.34996 | 0.23078 | 0.07311 | 0.02876 | 0.00083 | 0.01499 | 0.00441 | 0.00760 | 0.00112 | 0.01082 | 0.00920 | 0.25946 |
| Channel 2 | 0.08046 | 0.00000 | 0.00000 | 0.12644 | 0.45977 | 0.01149 | 0.00000 | 0.00000 | 0.00000 | 0.02299 | 0.00000 | 0.00000 | 0.01149 | 0.12644 | 0.16092 |
| Channel 3 | 0.22110 | 0.00005 | 0.00000 | 0.15465 | 0.12813 | 0.02383 | 0.01592 | 0.00000 | 0.00070 | 0.00154 | 0.00423 | 0.00035 | 0.00473 | 0.04432 | 0.40047 |
| Channel 4 | 0.37618 | 0.00004 | 0.00918 | 0.00000 | 0.20614 | 0.01010 | 0.00176 | 0.00001 | 0.00038 | 0.00321 | 0.00217 | 0.00016 | 0.00488 | 0.06617 | 0.31964 |
| Channel 5 | 0.20906 | 0.00006 | 0.00776 | 0.19783 | 0.00000 | 0.02327 | 0.00432 | 0.00079 | 0.00284 | 0.00252 | 0.00988 | 0.00053 | 0.01339 | 0.18544 | 0.34231 |
| Channel 6 | 0.06761 | 0.00004 | 0.00680 | 0.03876 | 0.20502 | 0.00000 | 0.00380 | 0.00014 | 0.00236 | 0.00043 | 0.00192 | 0.00068 | 0.01079 | 0.53286 | 0.12880 |
| Channel 7 | 0.04391 | 0.00000 | 0.00372 | 0.01489 | 0.02980 | 0.00188 | 0.00000 | 0.00000 | 0.00002 | 0.00041 | 0.01513 | 0.00004 | 0.00043 | 0.01731 | 0.87246 |
| Channel 8 | 0.03718 | 0.00000 | 0.00000 | 0.00489 | 0.29746 | 0.00489 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.01272 | 0.00391 | 0.63796 | 0.00098 |
| Channel 9 | 0.03907 | 0.00000 | 0.00108 | 0.01286 | 0.17187 | 0.02150 | 0.00049 | 0.00000 | 0.00000 | 0.00020 | 0.00118 | 0.00010 | 0.00982 | 0.72006 | 0.02179 |
| Channel 10 | 0.27363 | 0.00017 | 0.00670 | 0.15231 | 0.23827 | 0.01039 | 0.00318 | 0.00000 | 0.00034 | 0.00000 | 0.00134 | 0.00017 | 0.00419 | 0.08043 | 0.22889 |
| Channel 11 | 0.08723 | 0.00000 | 0.00374 | 0.02587 | 0.06770 | 0.00275 | 0.02786 | 0.00001 | 0.00015 | 0.00037 | 0.00000 | 0.00002 | 0.00180 | 0.02622 | 0.75627 |
| Channel 12 | 0.03582 | 0.00000 | 0.00361 | 0.01947 | 0.12188 | 0.01803 | 0.00264 | 0.00505 | 0.00096 | 0.00048 | 0.00048 | 0.00000 | 0.00505 | 0.71875 | 0.06779 |
| Channel 13 | 0.05314 | 0.00012 | 0.00258 | 0.07075 | 0.26652 | 0.01966 | 0.00255 | 0.00006 | 0.00317 | 0.00177 | 0.00494 | 0.00112 | 0.00000 | 0.20251 | 0.37110 |
| Conversion | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 1.00000 | 0.00000 |
| Null | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 0.00000 | 1.00000 |
The conversion rates are shown in Figure 17.
Figure 17: Conversion Rates
| Conversion Rates | |
|---|---|
| Method | Rate |
| Data Based | 0.18771 |
| Markov Chain | 0.18771 |
The removal effects are shown in Figure 18.
Figure 18: Removal Effects
| Removal Effects | |
|---|---|
| Channel | Effect |
| 1 | 0.07980 |
| 2 | 0.00003 |
| 3 | 0.00379 |
| 4 | 0.06379 |
| 5 | 0.11014 |
| 6 | 0.05682 |
| 7 | 0.01567 |
| 8 | 0.00079 |
| 9 | 0.00833 |
| 10 | 0.00157 |
| 11 | 0.00668 |
| 12 | 0.00335 |
| 13 | 0.01071 |
The removal effect of a channel is the decrease in the probability of overall conversion if the channel were removed. In Figure 18, you see that channel 5 (organic) leads to the greatest decrease in the probability of conversion if it is missing.
The contributions are just normalized removal effects to indicate each channel’s contribution to the conversion. The contributions of the Markov attribution model and the other three heuristic attribution models are shown side by side in Figure 19. The last-touch model does not place as much value on channel 1 (direct mail) as other methods do, but it attributes the most value to channel 5 (organic). The first-touch model does not value channel 4 (email) as much as other methods do, but it attributes the most value to channel 1 (direct mail). The Markov and linear attribution models have similar attribution values for most of the channels, except that there is a 9% difference between the two models on the contribution of channel 1 (direct mail). The position-based model and time-decay model both attribute less credit to channel 4 (email), which is the third most important channel according to the Markov model. The reason might be that the email channel always appears in the middle of the customer journey.
Figure 19: Channel Contributions
| Channel Contributions | ||||||
|---|---|---|---|---|---|---|
| Channel | Markov Chain | First Touch | Last Touch | Linear | Position Based | Time Decay |
| 1 | 0.22078 | 0.47248 | 0.02320 | 0.23493 | 0.24179 | 0.23236 |
| 2 | 0.00008 | 0.00003 | 0.00006 | 0.00005 | 0.00005 | 0.00005 |
| 3 | 0.01049 | 0.00238 | 0.00486 | 0.00442 | 0.00393 | 0.00408 |
| 4 | 0.17649 | 0.03489 | 0.13081 | 0.08445 | 0.08369 | 0.08707 |
| 5 | 0.30470 | 0.24707 | 0.43312 | 0.34435 | 0.34127 | 0.34541 |
| 6 | 0.15719 | 0.15831 | 0.26382 | 0.21558 | 0.21376 | 0.21484 |
| 7 | 0.04336 | 0.02774 | 0.03385 | 0.03106 | 0.03094 | 0.03090 |
| 8 | 0.00217 | 0.00136 | 0.00356 | 0.00255 | 0.00251 | 0.00258 |
| 9 | 0.02304 | 0.00714 | 0.04001 | 0.02437 | 0.02405 | 0.02434 |
| 10 | 0.00434 | 0.00092 | 0.00262 | 0.00176 | 0.00177 | 0.00188 |
| 11 | 0.01847 | 0.01194 | 0.01223 | 0.01237 | 0.01222 | 0.01219 |
| 12 | 0.00926 | 0.01408 | 0.01631 | 0.01515 | 0.01517 | 0.01521 |
| 13 | 0.02964 | 0.02166 | 0.03556 | 0.02897 | 0.02884 | 0.02908 |