Learn R Programming

BTYDplus (version 0.7.2)

nbd.GenerateData: Simulate data according to NBD model assumptions

Description

Simulate data according to NBD model assumptions

Usage

nbd.GenerateData(n, T.cal, T.star, params, return.elog = FALSE)

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.

return.elog

If TRUE then the event log is returned in addition to the CBS summary.

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 and t.

Examples

Run this code
# NOT RUN {
n <- 1000  # 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
# }

Run the code above in your browser using DataLab