{BTYD}R Documentation

BG/NBD Log-Likelihood Wrapper


Calculates the log-likelihood sum of the BG/NBD model.




BG/NBD parameters - a vector with r, alpha, a, and b, in that order. r and alpha are unobserved parameters for the NBD transaction process. a and b are unobserved parameters for the Beta geometric dropout process.

calibration period CBS (customer by sufficient statistic). It must contain columns for frequency ("x"), recency ("t.x"), and total time observed (""). 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, a fourth column labeled "custs" (number of customers with a specific combination of recency, frequency and length of calibration period) is available.


Note: do not use a compressed matrix. It makes quicker work for Pareto/NBD estimation as implemented in this package, but the opposite is true for BG/NBD. For proof, compare the definition of the to that of


The total log-likelihood of the provided data.

See Also




data(cdnowSummary) <- cdnowSummary$cbs
# already has column names required by method

# random assignment of parameters
params <- c(0.5, 6, 1.2, 3.3)
# returns the log-likelihood of the given parameters,

# compare the speed and results to the following: <- (params,

# Returns the log likelihood of the parameters for a customer who
# made 3 transactions in a calibration period that ended at t=6,
# with the last transaction occurring at t=4.
bgnbd.LL(params, x=3, t.x=4,

# We can also give vectors as function parameters:
x <- sample(1:4, 10, replace = TRUE)
t.x <- sample(1:4, 10, replace = TRUE) <- rep(4, 10)
bgnbd.LL(params, x, t.x,

[Package BTYD version 2.4.3 Index]