Learn R Programming

BTYDplus (version 0.7.2)

pnbd.GenerateData: Simulate data according to Pareto/NBD model assumptions

Description

Simulate data according to Pareto/NBD model assumptions

Usage

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

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 r, alpha, s, beta.

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 {
params <- list(r = 5, alpha = 10, s = 0.8, beta = 12)
data <- pnbd.GenerateData(n = 1000, T.cal = 32, T.star = 32, params, return.elog = TRUE)
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