View source: R/f_interface_predict_clvfittedspending.R
predict.clv.fitted.spending | R Documentation |
Predict customer's future mean spending per transaction and compare it to the actual mean spending in the holdout period.
## 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,
...
)
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 |
num.boots |
Number of bootstrap repetitions, if |
verbose |
Show details about the running of the function. |
... |
Ignored |
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.
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. |
models to predict spending: gg.
models to predict transactions: pnbd, bgnbd, ggomnbd.
predict
for transaction models
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.