Learn R Programming

BTYDplus (version 1.2.0)

mbgcnbd.PlotTrackingInc: (M)BG/CNBD-k Tracking Incremental Transactions Comparison

Description

Plots the actual and expected incremental total repeat transactions by all customers for the calibration and holdout periods, and returns this comparison in a matrix.

Usage

mbgcnbd.PlotTrackingInc(
  params,
  T.cal,
  T.tot,
  actual.inc.tracking.data,
  xlab = "Week",
  ylab = "Transactions",
  xticklab = NULL,
  title = "Tracking Weekly Transactions",
  ymax = NULL,
  legend = c("Actual", "Model")
)

bgcnbd.PlotTrackingInc( params, T.cal, T.tot, actual.inc.tracking.data, xlab = "Week", ylab = "Transactions", xticklab = NULL, title = "Tracking Weekly Transactions", ymax = NULL, legend = c("Actual", "Model") )

Arguments

params

A vector with model parameters k, r, alpha, a and b, in that order.

T.cal

A vector to represent customers' calibration period lengths.

T.tot

End of holdout period. Must be a single value, not a vector.

actual.inc.tracking.data

A vector containing the incremental number of repeat transactions made by customers for each period in the total time period (both calibration and holdout periods).

xlab

Descriptive label for the x axis.

ylab

Descriptive label for the y axis.

xticklab

A vector containing a label for each tick mark on the x axis.

title

Title placed on the top-center of the plot.

ymax

Upper boundary for y axis.

legend

plot legend, defaults to `Actual` and `Model`.

Value

Matrix containing actual and expected incremental repeat transactions.

Details

Note: Computational time increases with the number of unique values of T.cal.

See Also

mbgcnbd.ExpectedCumulativeTransactions

Examples

Run this code
# NOT RUN {
data("groceryElog")
groceryElog <- groceryElog[groceryElog$date < "2006-06-30", ]
cbs <- elog2cbs(groceryElog, T.cal = "2006-04-30")
inc <- elog2inc(groceryElog)
params <- mbgcnbd.EstimateParameters(cbs, k = 2)
mbgcnbd.PlotTrackingInc(params, cbs$T.cal,
  T.tot = max(cbs$T.cal + cbs$T.star), inc)
# }

Run the code above in your browser using DataLab