abe.GenerateData: Simulate data according to Pareto/NBD (Abe) model assumptions

Description Usage Arguments Value Examples

View source: R/pareto-nbd-abe.R

Description

Simulate data according to Pareto/NBD (Abe) model assumptions

Usage

1
2
3
4
5
6
7
8
abe.GenerateData(
  n,
  T.cal,
  T.star,
  params,
  date.zero = "2000-01-01",
  covariates = NULL
)

Arguments

n

Number of customers.

T.cal

Length of calibration period. If a vector is provided, then it is assumed that customers have different 'birth' dates, i.e. max(T.cal)-T.cal.

T.star

Length of holdout period. This may be a vector.

params

A list of model parameters: beta and gamma.

date.zero

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

covariates

Provide matrix of customer covariates. If NULL then random covariate values between [-1,1] are drawn.

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
# generate artificial Pareto/NBD (Abe) with 2 covariates
params <- list()
params$beta  <- matrix(c(0.18, -2.5, 0.5, -0.3, -0.2, 0.8), byrow = TRUE, ncol = 2)
params$gamma <- matrix(c(0.05, 0.1, 0.1, 0.2), ncol = 2)
data <- abe.GenerateData(n = 200, T.cal = 32, T.star = 32, params)
cbs <- data$cbs  # customer by sufficient summary statistic - one row per customer
elog <- data$elog  # Event log - one row per event/purchase

Example output



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