mcmc.Expectation: Unconditional Expectation for Pareto/GGG, Pareto/NBD (HB) and...

Description Usage Arguments Details Value Examples

View source: R/mcmc.R

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.

E(X(t))

.

Usage

1
mcmc.Expectation(draws, t, sample_size = 10000)

Arguments

draws

MCMC draws as returned by *.mcmc.DrawParameters

t

Length of time for which we are calculating the expected number of transactions. May also be a vector.

sample_size

Sample size for estimating the probability distribution.

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.

Value

Number of repeat transactions a customer is expected to make in a time period of length t.

Examples

1
2
3
4
5
data("groceryElog")
cbs <- elog2cbs(groceryElog)
param.draws <- pnbd.mcmc.DrawParameters(cbs,
  mcmc = 100, burnin = 50, thin = 10, chains = 1) # short MCMC to run demo fast
mcmc.Expectation(param.draws, t = c(26, 52))

BTYDplus documentation built on Jan. 21, 2021, 5:10 p.m.