pnbd.PlotFrequencyInCalibration {BTYD}R Documentation

Pareto/NBD Plot Frequency in Calibration Period

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

pnbd.PlotFrequencyInCalibration(
  params,
  cal.cbs,
  censor,
  hardie = TRUE,
  plotZero = TRUE,
  xlab = "Calibration period transactions",
  ylab = "Customers",
  title = "Frequency of Repeat Transactions"
)

Arguments

params

Pareto/NBD parameters - a vector with r, alpha, s, and beta, in that order. r and alpha are unobserved parameters for the NBD transaction process. s and beta are unobserved parameters for the Pareto (exponential gamma) dropout process.

cal.cbs

calibration period CBS (customer by sufficient statistic). It must contain columns for frequency ("x") and total time observed ("T.cal").

censor

integer used to censor the data. See details.

hardie

if TRUE, have pnbd.pmf use h2f1 instead of hypergeo.

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.

Details

This function requires a censor number, which cannot be higher than the highest frequency in the calibration period CBS. The output matrix will have (censor + 1) bins, starting at frequencies of 0 transactions and ending at a bin representing calibration period frequencies at or greater than the censor number. The plot may or may not include a bin for zero frequencies, depending on the plotZero parameter.

Value

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

Examples

data(cdnowSummary)
cal.cbs <- cdnowSummary$cbs
# cal.cbs already has column names required by method

# parameters estimated using pnbd.EstimateParameters
est.params <- cdnowSummary$est.params
# the maximum censor number that can be used
max(cal.cbs[,"x"])

pnbd.PlotFrequencyInCalibration(params = est.params, 
                                cal.cbs = cal.cbs, 
                                censor = 7, 
                                hardie = TRUE)

[Package BTYD version 2.4.3 Index]