pnbd.PlotFreqVsConditionalExpectedFrequency {BTYD}R Documentation

Pareto/NBD Plot Frequency vs. Conditional Expected Frequency


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


  hardie = TRUE,
  xlab = "Calibration period transactions",
  ylab = "Holdout period transactions",
  xticklab = NULL,
  title = "Conditional Expectation"



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.

length of the holdout period. It must be a scalar for this plot's purposes: you have one holdout period of a given length.

calibration period CBS (customer by sufficient statistic). It must contain columns for frequency ("x"), recency ("t.x"), and total time observed (""). 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.

vector of transactions made by each customer in the holdout period.


integer used to censor the data. See details.


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


descriptive label for the x axis.


descriptive label for the y axis.


vector containing a label for each tick mark on the x axis.


title placed on the top-center of the plot.


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.


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


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

# number of transactions by each customer in the 39 weeks
# following the calibration period <-[,""]

# parameters estimated using pnbd.EstimateParameters
est.params <- cdnowSummary$est.params
# the maximum censor number that can be used

# plot conditional expected holdout period frequencies,
# binned according to calibration period frequencies
pnbd.PlotFreqVsConditionalExpectedFrequency(params = est.params, 
                                   = 39, 
                                            censor = 7, 
                                            hardie = TRUE)

[Package BTYD version 2.4.3 Index]