nbd.GenerateData: Simulate data according to NBD model assumptions

Description Usage Arguments Value Examples

View source: R/nbd.R

Description

Simulate data according to NBD model assumptions

Usage

1
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

1
2
3
4
5
6
7
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

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