Skip to main content

Markov Model Feat R Code

R

#Load library and data

library(ChannelAttributionPro)

Data = read.csv("https://app.channelattribution.io/data/data_paths_w_features.csv",sep=";")

#Set your password

password="yourpassword"

#Define the type of each feature: 'categorial' or 'numeric'

D_feat_types=list('region'='categorial','segment'='categorial','seconds_to_last_touch'='numeric','position'='categorial')


#Train Markov model with external features

res=markov_model_feat(Data,D_feat_types,server="http://app.channelattribution.net",password=password)

#Return transaction-level attribution

print(res$attribution)

#Return estimated weigths for each feature at path level

print(res$weights_attr)

#Return predictive performance of each feature

print(res$weights_feat)