pnbd.PlotFreqVsConditionalExpectedFrequency {BTYD}  R Documentation 
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.
pnbd.PlotFreqVsConditionalExpectedFrequency( params, T.star, cal.cbs, x.star, censor, hardie = TRUE, xlab = "Calibration period transactions", ylab = "Holdout period transactions", xticklab = NULL, title = "Conditional Expectation" )
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. 
T.star 
length of the holdout period. It must be a scalar for this plot's purposes: you have one holdout period of a given length. 
cal.cbs 
calibration period CBS (customer by sufficient statistic). It must contain columns for frequency ("x"), recency ("t.x"), and total time observed ("T.cal"). 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. 
x.star 
vector of transactions made by each customer in the holdout period. 
censor 
integer used to censor the data. See details. 
hardie 
if TRUE, have

xlab 
descriptive label for the x axis. 
ylab 
descriptive label for the y axis. 
xticklab 
vector containing a label for each tick mark on the x axis. 
title 
title placed on the topcenter 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) cal.cbs < cdnowSummary$cbs # cal.cbs already has column names required by method # number of transactions by each customer in the 39 weeks # following the calibration period x.star < cal.cbs[,"x.star"] # parameters estimated using pnbd.EstimateParameters est.params < cdnowSummary$est.params # the maximum censor number that can be used max(cal.cbs[,"x"]) # plot conditional expected holdout period frequencies, # binned according to calibration period frequencies pnbd.PlotFreqVsConditionalExpectedFrequency(params = est.params, T.star = 39, cal.cbs = cal.cbs, x.star = x.star, censor = 7, hardie = TRUE)