abe.mcmc.DrawParameters {BTYDplus}R Documentation

Pareto/NBD (Abe) Parameter Draws

Description

Returns draws from the posterior distributions of the Pareto/NBD (Abe) parameters, on cohort as well as on customer level.

Usage

abe.mcmc.DrawParameters(
  cal.cbs,
  covariates = c(),
  mcmc = 2500,
  burnin = 500,
  thin = 50,
  chains = 2,
  mc.cores = NULL,
  trace = 100
)

Arguments

cal.cbs

Calibration period customer-by-sufficient-statistic (CBS) data.frame. It must contain a row for each customer, and columns x for frequency, t.x for recency and T.cal for the total time observed. A correct format can be easily generated based on the complete event log of a customer cohort with elog2cbs.

covariates

A vector of columns of cal.cbs which contain customer-level covariates.

mcmc

Number of MCMC steps.

burnin

Number of initial MCMC steps which are discarded.

thin

Only every thin-th MCMC step will be returned.

chains

Number of MCMC chains to be run.

mc.cores

Number of cores to use in parallel (Unix only). Defaults to min(chains, detectCores()).

trace

Print logging statement every trace-th iteration. Not available for mc.cores > 1.

Details

See demo('pareto-abe') for how to apply this model.

Value

List of length 2:

level_1

list of mcmc.lists, one for each customer, with draws for customer-level parameters k, lambda, tau, z, mu

level_2

mcmc.list, with draws for cohort-level parameters

References

Abe, M. (2009). "Counting your customers" one by one: A hierarchical Bayes extension to the Pareto/NBD model. Marketing Science, 28(3), 541-553. doi: 10.1287/mksc.1090.0502

See Also

abe.GenerateData mcmc.PAlive mcmc.DrawFutureTransactions

Examples

data("groceryElog")
cbs <- elog2cbs(groceryElog, T.cal = "2006-12-31")
cbs$cov1 <- as.integer(cbs$cust) %% 2 # create dummy covariate
param.draws <- abe.mcmc.DrawParameters(cbs, c("cov1"),
  mcmc = 100, burnin = 50, thin = 10, chains = 1) # short MCMC to run demo fast

# cohort-level parameter draws
as.matrix(param.draws$level_2)
# customer-level parameter draws for customer with ID '4'
as.matrix(param.draws$level_1[["4"]])

# estimate future transactions
xstar.draws <- mcmc.DrawFutureTransactions(cbs, param.draws, cbs$T.star)
xstar.est <- apply(xstar.draws, 2, mean)
head(xstar.est)

[Package BTYDplus version 1.2.0 Index]