Calculates the marginal likelihood of a customer's average transaction value.
spend.marginal.likelihood(params, m.x, x)
a vector of gamma-gamma parameters: p, q, and gamma, in that order. p is the shape parameter for each transaction. The scale parameter for each transaction is distributed across customers according to a gamma distribution with parameters q (shape) and gamma (scale).
the customer's average observed transaction value in the calibration period. May also be a vector of average observed transaction values - see details.
the number of transactions the customer made in the calibration period. May also be a vector of frequencies - see details.
x may be vectors. The standard rules for
vector operations apply - if they are not of the same length, the
shorter vector will be recycled (start over at the first element)
until it is as long as the longest vector. It is advisable to keep
vectors to the same length and to use single values for parameters
that are to be the same for all calculations. If one of these
parameters has a length greater than one, the output will be a
vector of probabilities.
This function will issue a warning if any of
x is 0, and will return a marginal likelihood of 0 for
f(m.x | p, q, gamma, x).
The marginal distribution of a customer's average
transaction value. If
x has a length greater
than 1, a vector of marginal likelihoods will be returned.
Fader, Peter S., Bruce G.S. Hardie, and Ka L. Lee. “RFM and CLV: Using Iso-Value Curves for Customer Base Analysis.” Journal of Marketing Research Vol.42, pp.415-430. November. 2005. http://www.brucehardie.com/papers.html
See equation 3.
1 2 3 4 5 6 7 8 9
params <- c(6, 4, 16) # calculate the marginal distribution of the average transaction value # of a customer who spent an average of $35 over 3 transactions. spend.marginal.likelihood(params, m.x=35, x=3) # Several values can also be computed at once: spend.marginal.likelihood(params, m.x=30:40, x=3) spend.marginal.likelihood(params, m.x=35, x=1:10) spend.marginal.likelihood(params, m.x=30:40, x=1:11)