pnbd.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.LL(params, x, t.x, T.cal, 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.

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

if TRUE, use h2f1 instead of hypergeo.

Value

A vector of log-likelihoods as long as the longest input vector (x, t.x, or T.cal).

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 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)

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