bgbb.PlotRecVsConditionalExpectedFrequency: BG/BB Plot Recency vs Conditional Expected Frequency

Description Usage Arguments Value References Examples

View source: R/bgbb.R

Description

Plots the actual and conditional expected number of transactions made by customers in the holdout period, binned according to calibration period recencies. Also returns a matrix with this comparison and the number of customers in each bin.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
bgbb.PlotRecVsConditionalExpectedFrequency(
  params,
  n.star,
  rf.matrix,
  x.star,
  trunc = NULL,
  xlab = "Calibration period recency",
  ylab = "Holdout period transactions",
  xticklab = NULL,
  title = "Conditional Expected Transactions by Recency"
)

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.

n.star

number of transaction opportunities in the holdout period.

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.

x.star

a vector containing the number of transactions made in the holdout period by the groups of customers with the same recency and frequency in the calibration period. It must be in the same order as the rf.matrix.

trunc

optional integer used to truncate the plot. In the plot, all calibration period frequencies above the truncation number will be removed. If the truncation number is greater than the maximum frequency, R will warn you and change it to the maximum frequency.

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.

Value

Holdout period transaction frequency comparison matrix (actual vs. expected), binned by calibration period recency.

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
data(donationsSummary)

rf.matrix <- donationsSummary$rf.matrix
# donationsSummary$rf.matrix already has appropriate column names

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

# get the holdout period transactions
x.star <- donationsSummary$x.star

# number of transaction opportunities in the holdout period
n.star <- 5

# Compare holdout period transactions.
bgbb.PlotRecVsConditionalExpectedFrequency(est.params, n.star, rf.matrix, x.star, trunc=6)

Example output

Loading required package: hypergeo
                rec.0        rec.1       rec.2       rec.3       rec.4
            0.1743649 2.181485e-01   0.3898876   0.4872521   0.8088685
            0.0728617 8.569864e-02   0.1798633   0.4041656   0.8511897
bin.size 3464.0000000 1.091000e+03 890.0000000 706.0000000 654.0000000
               rec.5       rec.6
            1.652289    2.946886
            1.726479    3.027298
bin.size 1136.000000 3163.000000

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