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

# S3 method for clv.fitted.spending
predict(object, newdata = NULL, verbose = TRUE, ...)

# S4 method for clv.fitted.spending
predict(object, newdata = NULL, 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.

verbose

Show details about the running of the function.

...

Ignored

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.

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.

See also

models to predict spending: gg.

models to predict transactions: pnbd, bgnbd, ggomnbd.

predict for transaction models

Examples

# \donttest{ data("apparelTrans") # Fit gg model on data apparel.holdout <- clvdata(apparelTrans, time.unit="w", estimation.split=37, date.format="ymd") apparel.gg <- gg(apparel.holdout)
#> Starting estimation...
#> Estimation finished!
# Predict customers' future mean spending per transaction predict(apparel.gg)
#> Id actual.mean.spending predicted.mean.spending #> 1: 1 0.00000 40.39473 #> 2: 10 0.00000 57.49121 #> 3: 100 32.06652 43.83628 #> 4: 1000 44.81640 43.46097 #> 5: 1001 33.09091 46.17636 #> --- #> 246: 1219 29.55429 33.20726 #> 247: 122 0.00000 40.39473 #> 248: 1220 0.00000 40.39473 #> 249: 1221 33.62778 34.00868 #> 250: 1222 0.00000 48.80122
# }