bgbb.PlotTrackingCum: BG/BB Tracking Cumulative Transactions Plot

Description Usage Arguments Details Value References Examples

View source: R/bgbb.R

Description

Plots the actual and expected cumulative total repeat transactions by all customers for the calibration and holdout periods. Also returns a matrix with this comparison.

Usage

1
2
3
4
5
6
7
8
9
bgbb.PlotTrackingCum(
  params,
  rf.matrix,
  actual.cum.repeat.transactions,
  xlab = "Time",
  ylab = "Cumulative Transactions",
  xticklab = NULL,
  title = "Tracking Cumulative Transactions"
)

Arguments

params

BG/BB parameters - a vector with alpha, beta, gamma, and delta, in that order. Alpha and beta are unobserved parameters for the beta-Bernoulli transaction process. Gamma and delta are unobserved parameters for the beta-geometric dropout process.

rf.matrix

recency-frequency matrix. It must contain columns for frequency ("x"), recency ("t.x"), number of transaction opportunities in the calibration period ("n.cal"), and the number of customers with this combination of recency, frequency and transaction opportunities in the calibration period ("custs"). Note that recency must be the time between the start of the calibration period and the customer's last transaction, not the time between the customer's last transaction and the end of the calibration period.

actual.cum.repeat.transactions

vector containing the cumulative number of repeat transactions made by customers in all transaction opportunities (both calibration and holdout periods). Its unit of time should be the same as the units of the recency-frequency matrix used to estimate the model parameters.

xlab

descriptive label for the x axis.

ylab

descriptive label for the y axis.

xticklab

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

title

title placed on the top-center of the plot.

Details

The holdout period should immediately follow the calibration period. This function assumes that all customers' calibration periods end on the same date, rather than starting on the same date (thus customers' birth periods are determined using max(n.cal) - n.cal rather than assuming that they are all 0).

Value

Matrix containing actual and expected cumulative repeat transactions.

References

Fader, Peter S., Bruce G.S. Hardie, and Jen Shang. "Customer-Base Analysis in a Discrete-Time Noncontractual Setting." Marketing Science 29(6), pp. 1086-1108. 2010. INFORMS. Web.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(donationsSummary)
# donationsSummary$rf.matrix already has appropriate column names
rf.matrix <- donationsSummary$rf.matrix

# starting-point parameters
startingparams <- c(1, 1, 0.5, 3)
# estimated parameters
est.params <- bgbb.EstimateParameters(rf.matrix, startingparams)

# get the annual repeat transactions, and transform them into
# a cumulative form
actual.inc.repeat.transactions <- donationsSummary$annual.trans
actual.cum.repeat.transactions <- cumsum(actual.inc.repeat.transactions)

# set appropriate x-axis
x.tickmarks <- c( "'96","'97","'98","'99","'00","'01","'02","'03","'04","'05","'06" )

# plot actual vs. expected transactions. The calibration period was 6 periods long.
bgbb.PlotTrackingCum(est.params, rf.matrix, actual.cum.repeat.transactions, xticklab=x.tickmarks)

Example output

Loading required package: hypergeo
             [,1]  [,2]    [,3]     [,4]     [,5]     [,6]     [,7]     [,8]
actual   5652.000 10326 14345.0 17897.00 21452.00 24615.00 27725.00 30663.00
expected 5535.886 10253 14400.7 18125.48 21521.51 24653.34 27567.31 30298.01
             [,9]    [,10]    [,11]
actual   33366.00 35939.00 37875.00
expected 32871.98 35310.08 37629.07

BTYD documentation built on Nov. 18, 2021, 1:10 a.m.