View source: R/pareto-nbd-mcmc.R
pnbd.mcmc.DrawParameters | R Documentation |
Returns draws from the posterior distributions of the Pareto/NBD (HB) parameters, on cohort as well as on customer level.
pnbd.mcmc.DrawParameters(
cal.cbs,
mcmc = 2500,
burnin = 500,
thin = 50,
chains = 2,
mc.cores = NULL,
use_data_augmentation = TRUE,
param_init = NULL,
trace = 100
)
cal.cbs |
Calibration period customer-by-sufficient-statistic (CBS)
data.frame. It must contain a row for each customer, and columns |
mcmc |
Number of MCMC steps. |
burnin |
Number of initial MCMC steps which are discarded. |
thin |
Only every |
chains |
Number of MCMC chains to be run. |
mc.cores |
Number of cores to use in parallel (Unix only). Defaults to |
use_data_augmentation |
deprecated |
param_init |
List of start values for cohort-level parameters. |
trace |
Print logging statement every |
See demo('pareto-ggg')
for how to apply this model.
2-element list:
level_1
list of mcmc.list
s, one for each customer, with draws for customer-level parameters lambda
, tau
, z
, mu
level_2
mcmc.list
, with draws for cohort-level parameters r
, alpha
, s
, beta
Ma, S. H., & Liu, J. L. (2007, August). The MCMC approach for solving the Pareto/NBD model and possible extensions. In Third international conference on natural computation (ICNC 2007) (Vol. 2, pp. 505-512). IEEE. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1109/ICNC.2007.728")}
Abe, M. (2009). "Counting your customers" one by one: A hierarchical Bayes extension to the Pareto/NBD model. Marketing Science, 28(3), 541-553. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1287/mksc.1090.0502")}
pnbd.GenerateData
mcmc.DrawFutureTransactions
mcmc.PAlive
data("groceryElog")
cbs <- elog2cbs(groceryElog, T.cal = "2006-12-31")
param.draws <- pnbd.mcmc.DrawParameters(cbs,
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.