spending: Formula Interface for Spending Models

View source: R/f_interface_spending.R

spendingR Documentation

Formula Interface for Spending Models

Description

Fit models for customer spending (currently only the Gamma-Gamma model).

Usage

spending(family, data, optimx.args = list(), verbose = TRUE, ...)

Arguments

family

A spending model (currently only gg).

data

A clv.data object.

optimx.args

Additional arguments to control the optimization which are forwarded to optimx::optimx. If multiple optimization methods are specified, only the result of the last method is further processed.

verbose

Show details about the running of the function.

...

Forwarded to model specified in family.

Value

Returns an object of the respective model which was fit.

See Also

Spending models for family: 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(family=gg, data=clv.cdnow)

# Fit gg with start params
spending(family=gg, data=clv.cdnow,
         start.params.model=c(p=0.5, q=15, gamma=2))

# Fit gg, do not remove first transaction
spending(family=gg, data=clv.cdnow, remove.first.transaction=FALSE)


## No formula may be given to specify covariates because currently
## no spending model uses covariates





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