mcmc.pmf: Probability Mass Function for Pareto/GGG, Pareto/NBD (HB) and...

View source: R/mcmc.R

mcmc.pmfR Documentation

Probability Mass Function for Pareto/GGG, Pareto/NBD (HB) and Pareto/NBD (Abe)

Description

Return the probability distribution of purchase frequencies for a random customer in a given time period, i.e. P(X(t)=x). This is estimated by generating sample_size number of random customers that follow the provided parameter draws. Due to this sampling, the return result varies from one call to another.

Usage

mcmc.pmf(draws, t, x, sample_size = 10000, covariates = NULL)

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.

x

Number of transactions for which probability is calculated. May also be a vector.

sample_size

Sample size for estimating the probability distribution.

covariates

(optional) Matrix of covariates, for Pareto/NBD (Abe) model, passed to abe.GenerateData for simulating data.

Value

P(X(t)=x). If either t or x is a vector, then the output will be a vector as well. If both are vectors, the output will be a matrix.

Examples

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.pmf(param.draws, t = c(26, 52), x = 0:6)

mplatzer/BTYDplus documentation built on April 9, 2024, 3:11 a.m.