pnbd.LL {BTYD} | R Documentation |
Calculates the log-likelihood of the Pareto/NBD model.
pnbd.LL(params, x, t.x, T.cal, hardie = TRUE)
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. |
x |
number of repeat transactions in the calibration period T.cal, or a vector of transaction frequencies. |
t.x |
time of most recent repeat transaction, or a vector of recencies. |
T.cal |
length of calibration period, or a vector of calibration period lengths. |
hardie |
A vector of log-likelihoods as long as the longest input vector (x, t.x, or T.cal).
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/
# 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. pnbd.LL(params, x=3, t.x=4, T.cal=6, hardie = TRUE) # We can also give vectors as function parameters: set.seed(7) x <- sample(1:4, 10, replace = TRUE) t.x <- sample(1:4, 10, replace = TRUE) T.cal <- rep(4, 10) pnbd.LL(params, x, t.x, T.cal, hardie = TRUE)