nbd.GenerateData {BTYDplus}R Documentation

Simulate data according to NBD model assumptions

Description

Simulate data according to NBD model assumptions

Usage

nbd.GenerateData(n, T.cal, T.star, params, date.zero = "2000-01-01")

Arguments

n

Number of customers.

T.cal

Length of calibration period.

T.star

Length of holdout period. This may be a vector.

params

NBD parameters - a vector with r and alpha in that order.

date.zero

Initial date for cohort start. Can be of class character, Date or POSIXt.

Value

List of length 2:

cbs

A data.frame with a row for each customer and the summary statistic as columns.

elog

A data.frame with a row for each transaction, and columns cust, date and t.

Examples

n <- 200  # no. of customers
T.cal <- 32  # length of calibration period
T.star <- 32  # length of hold-out period
params <- c(r = 0.85, alpha = 4.45)  # purchase frequency lambda_i ~ Gamma(r, alpha)
data <- nbd.GenerateData(n, T.cal, T.star, params)
cbs <- data$cbs  # customer by sufficient summary statistic - one row per customer
elog <- data$elog  # Event log - one row per event/purchase

[Package BTYDplus version 1.2.0 Index]