Learn R Programming

BTYD (version 2.4.3)

pnbd.ConditionalExpectedTransactions: Pareto/NBD Conditional Expected Transactions

Description

Uses Pareto/NBD model parameters and a customer's past transaction behavior to return the number of transactions they are expected to make in a given time period.

Usage

pnbd.ConditionalExpectedTransactions(
  params,
  T.star,
  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.

T.star

length of time for which we are calculating the expected number of transactions.

x

number of repeat transactions in the calibration period T.cal, or a vector of calibration period 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, have pnbd.PAlive use h2f1 instead of hypergeo.

Value

Number of transactions a customer is expected to make in a time period of length t, conditional on their past behavior. If any of the input parameters has a length greater than 1, this will be a vector of expected number of transactions.

Details

E[X(T.cal, T.cal + T.star) | x, t.x, r, alpha, s, beta]

T.star, x, t.x, and T.cal may be vectors. The standard rules for vector operations apply - if they are not of the same length, shorter vectors will be recycled (start over at the first element) until they are 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.

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.Expectation

Examples

Run this code
# NOT RUN {
params <- c(0.55, 10.56, 0.61, 11.64)
# Number of transactions a customer is expected to make in 2 time
# intervals, given that they made 10 repeat transactions in a time period
# of 39 intervals, with the 10th repeat transaction occurring in the 35th
# interval.
pnbd.ConditionalExpectedTransactions(params, 
                                     T.star = 2, 
                                     x = 10, 
                                     t.x = 35, 
                                     T.cal = 39, 
                                     hardie = TRUE)

# We can also compare expected transactions across different
# calibration period behaviors:
pnbd.ConditionalExpectedTransactions(params, 
                                     T.star = 2, 
                                     x = 5:20, 
                                     t.x = 25, 
                                     T.cal = 39, 
                                     hardie = TRUE)
# }

Run the code above in your browser using DataLab