pnbd.cbs.LL: Pareto/NBD Log-Likelihood

Description Usage Arguments Value References See Also Examples

View source: R/pnbd.R

Description

Calculates the log-likelihood of the Pareto/NBD model.

Usage

1
pnbd.cbs.LL(params, cal.cbs, hardie = TRUE)

Arguments

params

Pareto/NBD parameters - a vector with r, alpha, s, and beta, in that order. r and alpha are unobserved parameters for the NBD transaction process. s and beta are unobserved parameters for the Pareto (exponential gamma) dropout process.

cal.cbs

calibration period CBS (customer by sufficient statistic). It must contain columns for frequency ("x"), recency ("t.x"), and total time observed ("T.cal"). Note that recency must be the time between the start of the calibration period and the customer's last transaction, not the time between the customer's last transaction and the end of the calibration period. If your data is compressed (see dc.compress.cbs), a fourth column labelled "custs" (number of customers with a specific combination of recency, frequency and length of calibration period) will make this function faster.

hardie

if TRUE, use h2f1 instead of hypergeo.

Value

The log-likelihood of the provided data.

References

Fader, Peter S., and Bruce G.S. Hardie. "A Note on Deriving the Pareto/NBD Model and Related Expressions." November. 2005. Web. http://www.brucehardie.com/notes/008/

See Also

pnbd.EstimateParameters

pnbd.LL

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(cdnowSummary)
cal.cbs <- cdnowSummary$cbs
# cal.cbs already has column names required by method

# random assignment of parameters
params <- c(0.5, 8, 0.7, 10)
# returns the log-likelihood of the given parameters
pnbd.cbs.LL (params, cal.cbs, TRUE)

# compare the speed and results to the following:
cal.cbs.compressed <- dc.compress.cbs(cal.cbs)
pnbd.cbs.LL (params, cal.cbs.compressed, TRUE)

BTYD documentation built on Nov. 18, 2021, 1:10 a.m.