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

Description Usage Arguments Details Value See Also Examples

View source: R/mbg-cnbd-k.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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'.

Details

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

Value

Matrix containing actual and expected incremental repeat transactions.

See Also

mbgcnbd.ExpectedCumulativeTransactions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## 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)

## End(Not run)

Example output

              [,1]     [,2]    [,3]     [,4]     [,5]      [,6]    [,7]
actual   15.000000 33.00000 67.0000 64.00000 87.00000 112.00000 114.000
expected  3.572736 19.23098 39.1718 59.07971 79.93153  99.38606 116.946
             [,8]     [,9]    [,10]    [,11]    [,12]    [,13]    [,14]
actual   138.0000 141.0000 159.0000 174.0000 200.0000 173.0000 189.0000
expected 133.5559 149.1163 163.7215 177.8105 191.5045 199.4525 196.4741
            [,15]    [,16]    [,17]    [,18]    [,19]    [,20]    [,21]
actual   133.0000 180.0000 157.0000 146.0000 127.0000 138.0000 139.0000
expected 191.1096 185.5565 180.2739 175.3617 170.8221 166.6282 162.7467
            [,22]    [,23]    [,24]
actual   103.0000 141.0000 107.0000
expected 159.1445 155.7914 152.6611

BTYDplus documentation built on Jan. 21, 2021, 5:10 p.m.