bgbb.PlotFrequencyInCalibration {BTYD} | R Documentation |
BG/BB Plot Frequency in Calibration Period
Description
Plots the actual and expected number of customers who made a certain number of repeat transactions in the calibration period. Also returns a matrix with this comparison.
Usage
bgbb.PlotFrequencyInCalibration(
params,
rf.matrix,
censor = NULL,
plotZero = TRUE,
xlab = "Calibration period transactions",
ylab = "Customers",
title = "Frequency of Repeat 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. |
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. |
xlab |
descriptive label for the x axis. |
ylab |
descriptive label for the y axis. |
title |
title placed on the top-center of the plot. |
Value
Calibration 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
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)
# plot actual vs. expected frequencies in the calibration period
bgbb.PlotFrequencyInCalibration(est.params, rf.matrix)