gg {CLVTools}R Documentation

Gamma/Gamma Spending model


Fits the Gamma-Gamma model on a given object of class to predict customers' mean spending per transaction.


## S4 method for signature ''
  start.params.model = c(),
  optimx.args = list(),
  remove.first.transaction = TRUE,
  verbose = TRUE,


The data object on which the model is fitted.


Named start parameters containing the optimization start parameters for the model without covariates.


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.


Whether customer's first transaction are removed. If TRUE all zero-repeaters are excluded from model fitting.


Show details about the running of the function.




Model parameters for the G/G model are p, q, and gamma.
p: shape parameter of the Gamma distribution of the spending process.
q: shape parameter of the Gamma distribution to account for customer heterogeneity.
gamma: scale parameter of the Gamma distribution to account for customer heterogeneity.
If no start parameters are given, 1.0 is used for all model parameters. All parameters are required to be > 0.

The Gamma-Gamma model cannot be estimated for data that contains negative prices. Customers with a mean spending of zero or a transaction count of zero are ignored during model fitting.

The G/G model

The G/G model allows to predict a value for future customer transactions. Usually, the G/G model is used in combination with a probabilistic model predicting customer transaction such as the Pareto/NBD or the BG/NBD model.


An object of class is returned.

The function summary can be used to obtain and print a summary of the results. The generic accessor functions coefficients, vcov, fitted, logLik, AIC, BIC, and nobs are available.


Colombo R, Jiang W (1999). “A stochastic RFM model.” Journal of Interactive Marketing, 13(3), 2-12.

Fader PS, Hardie BG, Lee K (2005). “RFM and CLV: Using Iso-Value Curves for Customer Base Analysis.” Journal of Marketing Research, 42(4), 415-430.

Fader PS, Hardie BG (2013). “The Gamma-Gamma Model of Monetary Value.” URL

See Also

clvdata to create a clv data object.

plot to plot diagnostics of the transaction data, incl. of spending.

predict to predict expected mean spending for every customer.

plot to plot the density of customer's mean transaction value compared to the model's prediction.


data("apparelTrans") <- clvdata(apparelTrans, date.format = "ymd",
                            time.unit = "w", estimation.split = 40)

# Fit the gg model

# Give initial guesses for the model parameters
     start.params.model = c(p=0.5, q=15, gamma=2))

# pass additional parameters to the optimizer (optimx)
#    Use Nelder-Mead as optimization method and print
#    detailed information about the optimization process <- gg(,
                     optimx.args = list(method="Nelder-Mead",

# estimated coefs

# summary of the fitted model

# Plot model vs empirical distribution

# predict mean spending and compare against
#    actuals in the holdout period

[Package CLVTools version 0.9.0 Index]