ChannelAttribution (version 2.0.2)

choose_order: Choose order for Markov model.

Description

Find the minimum Markov Model order that gives a good representation of customers' behaviour for data considered. It requires paths that do not lead to conversion as input. Minimum order is found maximizing a penalized area under ROC curve.

Usage

choose_order(Data, var_path, var_conv, var_null, max_order=10, sep=">", 
             ncore=1, roc_npt=100, plot=TRUE)

Arguments

Data

data.frame containing customer journeys.

var_path

column name of Data containing paths.

var_conv

column name of Data containing total conversions.

var_null

column name of Data containing total paths that do not lead to conversion.

max_order

maximum Markov Model order considered.

sep

separator between channels.

ncore

number of threads used in computation.

roc_npt

number of points used for approximating roc and auc.

plot

if TRUE, a plot with penalized auc with respect to order will be displayed.

Value

An object of class List with the estimated roc, auc and penalized auc.

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
library(ChannelAttribution)

data(PathData) 

res=choose_order(Data, var_path="path", var_conv="total_conversions",
                 var_null="total_null")

#plot auc and penalized auc	   
	   
plot(res$auc$order,res$auc$auc,type="l",xlab="order",ylab="pauc",main="AUC")
lines(res$auc$order,res$auc$pauc,col="red")
legend("right", legend=c("auc","penalized auc"), 
       col=c("black","red"),lty=1)

# }

Run the code above in your browser using DataCamp Workspace