Learn R Programming

BTYD (version 2.4.3)

pnbd.Plot.DERT: Pareto/NBD Plot Discounted Expected Residual Transactions

Description

Plots discounted expected residual transactions for different combinations of calibration period frequency and recency.

Usage

pnbd.Plot.DERT(params, x, t.x, T.cal, d, hardie = TRUE, type = "persp")

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.

d

the discount rate to be used. Make sure that it matches up with your chosen time period (do not use an annual rate for monthly data, for example).

hardie

if TRUE, use h2f1 instead of hypergeo.

type

must be either "persp" (perspective - 3 dimensional) or "contour". Determines the type of plot produced by this function.

Value

A matrix with discounted expected residual transaction values for every combination of calibration period frequency x and calibration period recency t.x.

Details

The length of the calibration period T.cal must be a single value, not a vector.

References

Fader, Peter S., Bruce G.S. Hardie, and Ka L. Lee. "RFM and CLV: Using Iso-Value Curves for Customer Base Analysis." Journal of Marketing Research Vol.42, pp.415-430. November. 2005. http://www.brucehardie.com/papers.html

Note that this paper refers to what this package is calling discounted expected residual transactions (DERT) simply as discounted expected transactions (DET).

Examples

Run this code
# NOT RUN {
# The RFM and CLV paper uses all 78 weeks of the cdnow data to
# estimate parameters. These parameters can be estimated as follows:
# elog <- dc.ReadLines(system.file("data/cdnowElog.csv", package="BTYD2"),2,3)
# elog[, 'date'] <- as.Date(elog[, 'date'], format = '%Y%m%d')
# cal.cbs <- dc.ElogToCbsCbt(elog)$cal$cbs
# pnbd.EstimateParameters(cal.cbs, hardie = TRUE)

# (The final function was run several times with its own output as
# input for starting parameters, to ensure that the result converged).

params <- c(0.5629966, 12.5590370, 0.4081095, 10.5148048)

# 15% compounded annually has been converted to 0.0027 compounded continously,
# as we are dealing with weekly data and not annual data.
d <- 0.0027

pnbd.Plot.DERT(params = params, 
               x = 0:14, 
               t.x = 0:77, 
               T.cal = 77.86, 
               d = d, 
               hardie = TRUE, 
               type = "persp")
pnbd.Plot.DERT(params = params, 
               x = 0:14, 
               t.x = 0:77, 
               T.cal = 77.86, 
               d = d, 
               hardie = TRUE, 
               type="contour")
# }

Run the code above in your browser using DataLab