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)
Loading required package: hypergeo  0.01628041  0.02178306 0.02058508 0.01943300 0.01833037 0.01727922 0.01628041  0.01533388 0.01443890 0.01359421 0.01279820 0.01204899  0.01457300 0.01580541 0.01628041 0.01653229 0.01668839 0.01679462  0.01687158 0.01692991 0.01697564 0.01701246  0.01892075 0.01983798 0.01943300 0.01865303 0.01774288 0.01679462  0.01585007 0.01493027 0.01404619 0.01320346 0.01240461
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.