# \donttest{
data("cdnow")
# Create a CLV data object, split data in estimation and holdout sample
clv.data.cdnow <- clvdata(data.transactions = cdnow, date.format = "ymd",
time.unit = "week", estimation.split = 39, name.id = "Id")
# summary of data
summary(clv.data.cdnow)
# Fit a PNBD model without covariates on the first 39 periods
pnbd.cdnow <- pnbd(clv.data.cdnow,
start.params.model = c(r=0.5, alpha=8, s=0.5, beta=10))
# inspect fit
summary(pnbd.cdnow)
# Predict 10 periods (weeks) ahead from estimation end
# and compare to actuals in this period
pred.out <- predict(pnbd.cdnow, prediction.end = 10)
# Plot the fitted model to the actual repeat transactions
plot(pnbd.cdnow)
# }
Run the code above in your browser using DataLab