spending {CLVTools} | R Documentation |
Formula Interface for Spending Models
Description
Fit latent Gamma-Gamma model for customer spending with a formula interface
Usage
spending(formula, data, optimx.args = list(), verbose = TRUE)
Arguments
formula |
Formula specifying the model to be fit. See Details. |
data |
Either a |
optimx.args |
Additional arguments to control the optimization which are forwarded to |
verbose |
Show details about the running of the function. |
Value
Returns an object of the respective model which was fit.
See Also
Spending models for inputs: gg.
latentAttrition to fit latent attrition models with a formula interface
Examples
data("cdnow")
clv.cdnow <- clvdata(data.transactions = cdnow, date.format="ymd",
time.unit = "weeks")
# Fit gg
spending(~gg(), data=clv.cdnow)
# Fit gg with start params
spending(~gg(start.params.model=c(p=0.5, q=15, gamma=2)),
data=clv.cdnow)
# Fit gg, do not remove first transaction
spending(~gg(remove.first.transaction=FALSE), data=clv.cdnow)
# same, abreviate parameters
spending(~gg(remo=F), data=clv.cdnow)
# Fit gg on given data.frame transaction data, no split
spending(data()~gg(), data=cdnow)
# Fit gg on given data.frame, split after 39 periods
spending(data(split=39)~gg(), data=cdnow)
# same but also give date format and period definition
spending(data(split=39, format=ymd, unit=w)~gg(), data=cdnow)
## No covariate may be selected or covariate data.frame may be
## given because currently no spending model uses covariates
[Package CLVTools version 0.10.0 Index]