mbgcnbd.PlotTrackingCum: (M)BG/CNBD-k Tracking Cumulative Transactions Plot

Description Usage Arguments Details Value See Also Examples

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

Description

Plots the actual and expected cumulative 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.PlotTrackingCum(
  params,
  T.cal,
  T.tot,
  actual.cu.tracking.data,
  xlab = "Week",
  ylab = "Cumulative Transactions",
  xticklab = NULL,
  title = "Tracking Cumulative Transactions",
  ymax = NULL,
  legend = c("Actual", "Model")
)

bgcnbd.PlotTrackingCum(
  params,
  T.cal,
  T.tot,
  actual.cu.tracking.data,
  xlab = "Week",
  ylab = "Cumulative Transactions",
  xticklab = NULL,
  title = "Tracking Cumulative 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.cu.tracking.data

A vector containing the cumulative 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 cumulative 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")
cum <- elog2cum(groceryElog)
params <- mbgcnbd.EstimateParameters(cbs, k = 2)
mbgcnbd.PlotTrackingCum(params, cbs$T.cal,
  T.tot = max(cbs$T.cal + cbs$T.star), cum)

## End(Not run)

Example output

             [,1]     [,2]     [,3]     [,4]     [,5]     [,6]     [,7]
actual   1.000000 16.00000 49.00000 116.0000 180.0000 267.0000 379.0000
expected 3.171686 20.46487 56.24811 110.1114 183.4823 274.9019 382.7925
             [,8]     [,9]    [,10]    [,11]    [,12]    [,13]    [,14]
actual   493.0000 631.0000 772.0000 931.0000 1105.000 1305.000 1478.000
expected 506.5259 644.6476 796.6312 961.7158 1139.415 1328.743 1519.532
            [,15]    [,16]    [,17]    [,18]    [,19]    [,20]    [,21]
actual   1667.000 1800.000 1980.000 2137.000 2283.000 2410.000 2548.000
expected 1706.071 1887.494 2063.866 2235.474 2402.654 2565.729 2724.999
            [,22]    [,23]    [,24]   [,25]
actual   2687.000 2790.000 2931.000 3038.00
expected 2880.735 3033.181 3182.554 3329.05

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