Learn R Programming

BTYDplus (version 1.2.0)

mcmc.PlotFrequencyInCalibration: Frequency in Calibration Period for Pareto/GGG, Pareto/NBD (HB) and Pareto/NBD (Abe)

Description

Plots a histogram and returns a matrix comparing the actual and expected number of customers who made a certain number of repeat transactions in the calibration period, binned according to calibration period frequencies.

Usage

mcmc.PlotFrequencyInCalibration(
  draws,
  cal.cbs,
  censor = 7,
  xlab = "Calibration period transactions",
  ylab = "Customers",
  title = "Frequency of Repeat Transactions",
  sample_size = 1000
)

Arguments

draws

MCMC draws as returned by *.mcmc.DrawParameters

cal.cbs

Calibration period customer-by-sufficient-statistic (CBS) data.frame. It must contain columns for frequency ('x') and total time observed ('T.cal').

censor

Cutoff point for number of transactions in plot.

xlab

Descriptive label for the x axis.

ylab

Descriptive label for the y axis.

title

Title placed on the top-center of the plot.

sample_size

Sample size for estimating the probability distribution. See mcmc.pmf.

Value

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

Details

The method mcmc.pmf is called to calculate the expected numbers based on the corresponding model.

See Also

mcmc.pmf

Examples

Run this code
# NOT RUN {
data("groceryElog")
cbs <- elog2cbs(groceryElog, T.cal = "2006-12-31")
param.draws <- pnbd.mcmc.DrawParameters(cbs,
  mcmc = 100, burnin = 50, thin = 10, chains = 1) # short MCMC to run demo fast
mcmc.PlotFrequencyInCalibration(param.draws, cbs, sample_size = 100)
# }

Run the code above in your browser using DataLab