bgbb.PlotFrequencyInHoldout: BG/BB Plot Frequency in Holdout

Description Usage Arguments Value References Examples

View source: R/bgbb.R

Description

Plots the actual and expected number of customers who made a certain number of transactions in the holdout period, binned according to holdout period frequencies. 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
bgbb.PlotFrequencyInHoldout(
  params,
  n.cal,
  rf.matrix.holdout,
  censor = NULL,
  plotZero = TRUE,
  title = "Frequency of Repeat Transactions",
  xlab = "Holdout period transactions",
  ylab = "Customers"
)

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.cal

number of transaction opportunities in the calibration period.

rf.matrix.holdout

holdout period recency-frequency matrix. It must contain columns for frequency in the holdout period ("x.star"), the number of transaction opportunities in the holdout period ("n.star"), and the number of customers with each frequency ("custs").

censor

optional. Any calibration period frequency at this number, or above it, will be binned together. If the censor number is greater than the maximum recency in the recency-frequency matrix, the maximum recency will be used as the censor number.

plotZero

If FALSE, the histogram will exclude the zero bin.

title

title placed on the top-center of the plot.

xlab

descriptive label for the x axis.

ylab

descriptive label for the y axis.

Value

Holdout period repeat transaction frequency comparison matrix (actual vs. expected).

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

rf.matrix <- donationsSummary$rf.matrix
rf.matrix.holdout <- donationsSummary$rf.matrix.holdout
# donationsSummary$rf.matrix and donationsSummary$rf.matrix.holdout already
# have appropriate column names

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

# number of periods in the calibration period
n.cal = max(rf.matrix[,"n.cal"])

bgbb.PlotFrequencyInHoldout(est.params, n.cal, rf.matrix.holdout)

Example output

Loading required package: hypergeo
                          0        1        2        3        4        5
actual.frequency   6746.000 926.0000 772.0000 812.0000 886.0000  962.000
expected.frequency 6964.426 793.8732 745.7346 749.5204 810.3966 1040.049

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