predict.clv.fitted.spending: Predict customers' future spending

View source: R/f_interface_predict_clvfittedspending.R

predict.clv.fitted.spendingR Documentation

Predict customers' future spending

Description

Predict customer's future mean spending per transaction and compare it to the actual mean spending in the holdout period.

Usage

## S3 method for class 'clv.fitted.spending'
predict(
  object,
  newdata = NULL,
  uncertainty = c("none", "boots"),
  level = 0.9,
  num.boots = 100,
  verbose = TRUE,
  ...
)

## S4 method for signature 'clv.fitted.spending'
predict(
  object,
  newdata = NULL,
  uncertainty = c("none", "boots"),
  level = 0.9,
  num.boots = 100,
  verbose = TRUE,
  ...
)

Arguments

object

A fitted spending model for which prediction is desired.

newdata

A clv data object for which predictions should be made with the fitted model. If none or NULL is given, predictions are made for the data on which the model was fit.

uncertainty

Method to produce confidence intervals of the predictions (parameter uncertainty). Either "none" (default) or "boots".

level

Required confidence level, if uncertainty="boots".

num.boots

Number of bootstrap repetitions, if uncertainty="boots". A low number may not produce intervals for all customers if they are not sampled.

verbose

Show details about the running of the function.

...

Ignored

Details

If newdata is provided, the individual customer statistics underlying the model are calculated the same way as when the model was fit initially. Hence, if remove.first.transaction was TRUE, this will be applied to newdata as well.

Value

An object of class data.table with columns:

Id

The respective customer identifier

actual.mean.spending

Actual mean spending per transaction in the holdout period. Only if there is a holdout period otherwise it is not reported.

predicted.mean.spending

The mean spending per transaction as predicted by the fitted spending model.

See Also

models to predict spending: gg.

models to predict transactions: pnbd, bgnbd, ggomnbd.

predict for transaction models

Examples


data("apparelTrans")

# Fit gg model on data
apparel.holdout <- clvdata(apparelTrans, time.unit="w",
                           estimation.split = 52, date.format = "ymd")
apparel.gg <- gg(apparel.holdout)

# Predict customers' future mean spending per transaction
predict(apparel.gg)




CLVTools documentation built on Oct. 13, 2024, 9:07 a.m.