Learn R Programming

BTYDplus (version 0.7.2)

mcmc.PlotTrackingCum: Tracking Cumulative Transactions Plot for Pareto/GGG, Pareto/NBD (HB) and Pareto/NBD (Abe)

Description

Plots the actual and expected cumulative total repeat transactions by all customers for the calibration and holdout periods, and returns this comparison in a matrix.

Usage

mcmc.PlotTrackingCum(draws, T.cal, T.tot, actual.cu.tracking.data,
  xlab = "Week", ylab = "Cumulative Transactions", xticklab = NULL,
  title = "Tracking Cumulative Transactions", ymax = NULL,
  sample_size = 10000)

Arguments

T.cal

A vector to represent customers' calibration period lengths (in other words, the T.cal column from a customer-by-sufficient-statistic matrix). Considering rounding in order to speed up calculations.

T.tot

End of holdout period. Must be a single value, not a vector.

actual.cu.tracking.data

A vector containing the cumulative number of repeat transactions made by customers for each period in the total time period (both calibration and holdout periods).

xlab

Descriptive label for the x axis.

ylab

Descriptive label for the y axis.

xticklab

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

title

Title placed on the top-center of the plot.

ymax

Upper boundary for y axis.

sample_size

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

Value

Matrix containing actual and expected cumulative repeat transactions.

Details

The expected transactions need to be sampled. Due to this sampling, the return result varies from one call to another. Larger values of sample_size will generate more stable results.

See Also

mcmc.PlotTrackingInc mcmc.ExpectedCumulativeTransactions elog2cum

Examples

Run this code
# NOT RUN {
cdnow <- cdnow.sample()
cbs <- cdnow$cbs
cum <- elog2cum(cdnow$elog)
# short MCMC runs and small sample size to speedup demo
param.draws <- pnbd.mcmc.DrawParameters(cbs, 
  mcmc = 200, burnin = 100, thin = 20, chains = 1) 
mat <- mcmc.PlotTrackingCum(param.draws, cbs$T.cal, T.tot = 78, cum,
  sample_size = 1000)
# }

Run the code above in your browser using DataLab