Learn R Programming

BTYDplus (version 0.7.2)

mcmc.ExpectedCumulativeTransactions: Expected Cumulative Transactions for Pareto/GGG, Pareto/NBD (HB) and Pareto/NBD (Abe)

Description

Uses model parameter draws to return the expected number of repeat transactions that a randomly chosen customer (for whom we have no prior information) is expected to make in a given time period.

Usage

mcmc.ExpectedCumulativeTransactions(draws, T.cal, T.tot, n.periods.final,
  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.

n.periods.final

Number of time periods in the calibration and holdout periods.

sample_size

Sample size for estimating the probability distribution.

Value

Numeric vector of expected cumulative total repeat transactions by all customers.

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

bgcnbd.ExpectedCumulativeTransactions

Examples

Run this code
# NOT RUN {
cbs <- cdnow.sample()$cbs
# short MCMC runs and small sample size to speedup demo
param.draws <- pnbd.mcmc.DrawParameters(cbs, 
  mcmc = 200, burnin = 100, thin = 20, chains = 1) 
# Returns a vector containing cumulative repeat transactions for 546 days.
# All parameters are in weeks; the calibration period lasted 39 weeks
# and the holdout period another 39.
mcmc.ExpectedCumulativeTransactions(param.draws, 
  T.cal = cbs$T.cal, T.tot = 78, n.periods.final = 78, sample_size = 1000)
# }

Run the code above in your browser using DataLab